Q2 1-50 Flashcards
- What are the three main states that any living process may have?
Ready to run: Means it could use the CPU immediately (if it is allowed to do so. The scheduler decides which of the ready processes to run next)
Running: For a short slice of time only
Blocked or sleeping: Waiting for an event to occur,e.g., I/O or signal
- What is the Unix process?
A process (a program that is executing)
- In Unix, what is the difference between a process ready state and blocked state?
Ready = Waiting on the scheduler to decide which process runs next. Blocked = waiting for event to finish.
- Under which condition does a Unix process enter a blocked state?
Waiting for an event to occur,e.g., I/O or signal
- What is the Unix PID?
Process ID = Keep track of all processes in the system.Similar to the idea of inodes in case of files, or S.I.N. in our daily life
- In a Unix operating system, scheduling services are performed by a program called scheduler. What are the main tasks that a schedule perform?
Maintains a list of all the processes waiting to execute- Chooses one process at a time, and gives it a chance to runfor a short time called time slice (typically 10 milliseconds)
Saves data related to the interrupted processes so that they canbe resumed later
- List five of the Unix system calls that coordinate processes. Describe the main function of each of them.
fork: creates a copy (child) of the current process (parent)
exec: changes the program that a process is running
wait: forces a process to pause until another process finishing its execution
exit: terminates a process
chomd: change permissions
- What are the main differences between internal and external Unix commands?
Internal commands: Interpreted directly by the shell (no need to create a new process)
External commands: Required the shell to run a separate program (need to create a newprocess)
- Explain what will happen when executing a Unix external command.
The shell will use fork system call to createa duplicate of the currently running program. The duplicate (child process) and the original (parent process) proceed from the point of the fork with exactly the same data. The only difference is the return value from the fork call.
- In Unix, what is the relation between child and parent processes?
The duplicate (child process) and the original (parent process) proceed from the point of the fork with exactly the same data. The only difference is the return value from the fork call.fork returns the child PID to the parent process and 0 to the child process
- What is the Unix PPID?
Parent Process ID
- Explain in details what will happen when a process executes the fork system call.
Fork is an operation whereby a process creates a copy of itself. It is usually a system call, implemented in the kernel.1. Process is duplicated.2. Child inherits the properties (descriptors) from the Parent.3. The parent and the child share data content (like a pointer).4. If a parent process unexpectedly died,The child will keep executing,The child process is considered to be an orphan
- Explain in details what will happen when a process executes the exec system call.
exec: changes the program that a process is running *
- What is the Unix Zombie state?
A zombie process is a process that completed execution but still in process table.
- When does a Unix process enter a Zombie state?
When a process ends, all of the memory and resources associated with it are deallocated so they can be used by other processes. However, the process’s entry in the process table remains. The parent can read the child’s exit status by executing the wait system call, at which stage the zombie is removedAfter the zombie is removed, its process ID and entry in the process table can then be reused. However, if a parent fails to call wait, the zombie will be left in the process table. In some situations this may be desirable, for example if the parent creates another child process it ensures that it will not be allocated the same process ID.
- What is the Unix job?
A job refers to all the processes that are necessary to execute anentire command line
- In Unix systems, what is the only living ancestor of all other processes in the system? Explain why.
In Unix, toward the end of the boot procedure, the kernelcreates a special process by hand without forking This process is given a PID of 0 (process#0) Process#0 initializes many data structures needed by the kernel At the end, it forks process#1 andthen somehow disappeared (terminated itself)
- In Unix, what is an orphan process?
Orphan processes is kind of the opposite situation of zombie processes, since it refers to the case where a parent process terminates before its child processes, in which case these children are said to become “orphaned”.The child will keep executing
- In Unix, when does a process become an orphan?
If a parent process unexpectedly died (before the child)