Chapter 7 Flashcards
Does fork return child 0 and parent process child process id
Yes
What exec do
It takes 1 parameter. The process who call exec will be terminated.
What is wait system call
The wait system call suspends the calling process until one of its immediate children terminates. On success of wait call, terminated child process process ID is returned.
What is zombie state
If a process creates its children. And then parent process get terminated then child process comes in zombie state. Child process can not send its exit call to its parent process. And then the ownership of child process goes to init process who its grand parent.
Child process sends a exit call to which process on termination
Its parent process
What parameter should be passed to exit it is terminates normally
0
What parameter should be passed to exit it is terminates abnormally
non-zero value (positive integer)
What is exec() call
Typically the exec system call is used after a fork system call by child or parent process.
Can we return from successful exec() call and if no then why
No. Because the calling process image is overlaid by the new process image
What is fork call
System call fork() is used to create processes. It takes no arguments and returns a process ID. The purpose of fork() is to create a new process, which becomes the child process of the caller. After a new child process is created, both processes will execute the next instruction following the fork() system call. Therefore, we have to distinguish the parent from the child. This can be done by testing the returned value of fork():
If fork() returns a negative value, the creation of a child process was unsuccessful. fork() returns a zero to the newly created child process. fork() returns a positive value, the process ID of the child process, to the parent.
What ls -l do
Display long listing of directory
What is cooperating processes
An independent process cannot affect or be affected by the execution of another process. But cooperating process can affect or be affected by the execution of another process.
What are advantages of cooperating processes
- Information sharing
- Computation speed
- Modularity
- Convenience
What is producer-consumer problem
It is problem of cooperating processes. Producer produces information and place in a fixed size buffer, that is consumed by a consumer process.