Week 5: Process: Implementation Unix and WinNT Flashcards
What does the exec system call function do in UNIX?
It replaces the current process with a new process but retains access to open files.
What does the fork system call do in UNIX?
It creates an exact duplicate of the original process, including code, data, program counter, and open files.
What does the wait system call do?
It causes the parent process to block until a child process terminates, returning the process ID of the terminated child.
What happens when a process calls exit?
The process terminates and can return a status value to its parent.
What happens if a parent process terminates before its child?
The child becomes an orphan, and the init process adopts it.
What happens if a child terminates, but the parent is not waiting
The child becomes a zombie and the parent waits
Why are fork and exec separate in UNIX?
- To allow the child process to perform tasks before the exec takes place
- Sometimes they are used alone
How does process creation in MS-DOS differ from UNIX?
MS-DOS suspends the parent process while the child runs, and the parent resumes after the child completes.
What is the “terminate and stay resident” (TSR) mechanism in MS-DOS?
It’s a way to simulate multitasking by allowing a process to remain in memory while other processes run.
What is the basic unit of scheduling in Windows NT?
A thread, which is a lightweight process, sharing the same code and data within a process.
What are the main system calls for process and thread creation in Windows NT?
- CreateProcess for processes
- CreateThread for threads.
How does Windows NT handle synchronization between parent and child processes?
Through message passing and special kernel routines for inter-process communication.
What are the two parts included in a UNIX process structure?
- The user part
- The kernel part
What are the two key data structures related to processes the kernel maintains?
- The process table
- The user structure
What information does a process table hold?
- Process identification: process ID, parent process ID, user ID and group ID of process owner
- Scheduling information: process status (sleeping, executing, swapped), current priority
- Memory image pointers: pointers to the code (instructions), data and stack segments
- Signal information: showing which signals are trapped, ignored, pending, etc.
What information does the user structure hold?
- Execution state information: values of processor registers, current system call (parameters, results, status), kernel stack
- File descriptor table: one entry per open file (holds file modes (rw), status, position), information on where to find the file
- Accounting information: keeps track of total user and system processor time, some implementations have limits to processor, memory, etc.
- Pointer to process table entry
How does the UNIX scheduler work?
It uses a two-level system: a low-level (short-term) scheduler for CPU allocation and a high-level (long-term) scheduler for swapping processes.
What algorithm does the UNIX scheduler use?
Dynamic Priority Queue
What 5 rules does the UNIX scheduler use?
- The lower the priority number the higher the priority
- Kernel processes have priorities less than 0
- User processes have priorities ≥ 0
- Kernel processes are not preemptable
- User processes are preempted after a quantum of 5 ticks
What is the usual base priority value?
0
CPU(0) = 0
What is the formula for recalculating UNIX dynamic priorities?
- priority(n) = base + CPU(n)
- CPU(n) = ticks_used(n) + CPU(n-1)/2.
What is the purpose of the nice system call in UNIX?
It allows users to deliberately lower a process’s priority by increasing its base value.
How are priorities grouped in WinNT?
- realtime priorities (16 - 31): used for time-critical threads, only available to users with administrator privilege
- dynamic priorities (0 - 15): used for application program threads
How are dynamic priority levels in Windows NT grouped?
Into high (11-15), normal (6-10), and idle (2-6).
What is the time quantum for the Windows NT scheduler on different systems?
The NT scheduler is basically a priority queue
120 ms on NT Server, and 20, 40, or 60 ms on NT Workstation depending on user settings.
What happens when a thread requests a system resource in Windows NT?
It is blocked, and the scheduler switches to another thread. When the thread becomes unblocked, it either resumes immediately or is requeued.
In which only group of priority levels does the Windows NT have dynamic priority tuning?
Only to dynamic priority levels
What events cause priority boosts in Windows NT?
Keyboard or mouse wakeup (+6), other event wakeups (+1), and foreground application boosts.
What is priority decay in Windows NT?
In a case in which a thread, which has been boosted, uses an entire quantum without waiting, then its priority decreases by 1 (each time) until it gets back to its original level
How does Windows NT prevent starvation?
A high-priority system thread boosts low-priority threads that haven’t executed in over 3 seconds to priority 15.
What happens after a thread receives an anti-starvation boost?
It doubles its quantum and immediately executes before returning to its original priority and quantum.