Dont know these types of questions are asked here or not but if any one has idea please help me.
i just started started learning system programming and want to pursue a career in the sys prog area.
below is the program that use a fork() call.
i read in one of the tutorials that parent process and child process uses different address spaces and runs concurrently.
that meas each process gets some slice of cpu time, then the statements in that process are executed.
my Questions:
1.is there any way to know how much timeslice each process is getting.
2.what kind of scheduling its using
3. can i print the out put one page at a time ( should wait for keypress to print next page)
4. any links that provides good system programming info(message queues, pipes,shared memory etc.. )
5. appications that uses sockets
below is some example prog:
#include <stdio.h>
#include <sys/types.h>
#define MAX_COUNT 200
void ChildProcess(pid_t); /* child process prototype */
void ParentProcess(pid_t); /* parent process prototype */
void main(void)
{
pid_t pid;
pid = fork();
if (pid == 0)
ChildProcess(pid);
else
ParentProcess(pid);
}
void ChildProcess(pid_t pid)
{
int i;
char buf[40];
for(i=1; i <= MAX_COUNT; i++) {
sprintf(buf, "This line is from pid %d, value = %d\n", pid, i);
write(1, buf, strlen(buf));
}
}
void ParentProcess(pid_t pid)
{
int i;
char buf[40];
for(i=1; i <= MAX_COUNT; i++) {
sprintf(buf, "This line is from pid %d, value = %d\n", pid, i);
write(1, buf, strlen(buf));
}
}
thanks in advance.