1/87
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
What is an operating system?
Software that manages hardware and software resources and provides services for programs.
Why do operating systems exist?
To manage resources, run programs, and make computers easier and safer to use.
What are examples of operating system environments?
Desktop computers, servers, mobile devices, embedded systems, and real-time systems.
What services does an OS provide?
Program execution, I/O, file management, process communication, resource allocation, and security.
What is user mode?
A restricted execution mode for regular applications.
What is kernel mode?
A privileged mode where the OS can access protected hardware and perform privileged operations.
How does a program request a privileged OS service?
Through a system call, which traps into kernel mode.
What is a system call?
An interface that lets a program request services from the operating system.
What are the steps for copying a file with OS services?
Open the input file and create/open the output file; read the input; write the output.
What is the Unix root directory?
/ — the top of the filesystem hierarchy.
What is /home used for?
User home directories.
What is /bin used for?
Essential commands.
What is /etc used for?
System configuration files.
What is /tmp used for?
Temporary files.
What is /usr used for?
User utilities and applications.
What is /var used for?
Variable data such as logs.
What are privileged operations?
Operations requiring kernel mode, such as protected hardware access, process management, and protected file operations.
What is a trap table?
A table installed by the OS during boot that tells hardware where to find interrupt, exception, and system-call handlers.
What happens when an interrupt occurs?
Control transfers to the handler address listed in the trap table.
What is a timer interrupt?
An interrupt that gives the OS control so it can manage scheduling and potentially switch processes.
Why might interrupts be disabled while processing an interrupt?
To prevent interference from another interrupt during sensitive handler work, as described in the review.
What is a process?
A program that is currently executing.
What data structure represents a process?
The Process Control Block (PCB).
What important information is stored in a PCB?
Process state, PID, program counter, CPU registers, memory information, I/O status, and scheduling information.
What does the program counter store?
The address of the next instruction to execute.
What does a PID identify?
A unique process.
How does a Unix process create a child process?
By calling fork().
What does fork() do?
Creates a child process; the parent receives the child PID and the child receives 0; both continue after fork().
What is a context switch?
When the CPU stops running one process and starts running another.
What are the main steps in a context switch?
Trap to kernel; save the current process context; restore the next process context; return from trap and resume execution.
What is the difference between a PCB and a TCB?
A PCB describes an entire process; a TCB describes one thread and its execution state.
What information does a TCB hold?
Thread state, program counter, stack pointer, and CPU state.
What do threads in the same process share?
Code and data; each has its own stack and program counter.
What are user-level threads?
Threads managed by a user-space thread library rather than individually by the kernel.
What are kernel-level threads?
Threads managed and scheduled by the OS kernel.
What is one advantage of user-level threads?
They are generally faster to create and manage.
What is one limitation of many-to-one user-level threading?
A blocking thread can block the whole process, and threads cannot run on multiple CPUs simultaneously.
What is an advantage of kernel-level threads?
Other threads can run when one blocks, and threads can execute on multiple CPUs.
What is a bounded buffer?
A fixed-size storage area shared by producers and consumers.
What happens when a bounded buffer is full or empty?
Producers wait when full; consumers wait when empty.
How many usable slots does the review slide’s circular buffer of BUFFER_SIZE 10 have?
9, because the example reserves one slot (BUFFER_SIZE - 1).
What is a named pipe?
A FIFO communication mechanism that can connect processes without a parent-child relationship.
What capabilities does the review attribute to named pipes?
Bidirectional communication and use by several processes.
What does atomic execution mean?
A set of operations acts as one indivisible unit without interference.
What is a race condition?
When a program result depends on the timing or order of concurrent execution.
What is mutual exclusion?
Ensuring only one thread or process accesses a protected critical section at a time.
What is a critical section?
Code accessing shared resources that requires synchronization.
What mechanisms can help prevent race conditions?
Mutex locks, semaphores, and other synchronization primitives.
What is a spin lock?
A lock where a waiting thread repeatedly checks whether the lock is available.
What are drawbacks of spin locks?
Busy waiting wastes CPU cycles; fairness is not guaranteed and starvation is possible.
What can avoid wasting CPU time through spin-lock busy waiting?
Blocking synchronization mechanisms, such as condition variables and semaphores.
What is a condition variable?
A synchronization mechanism that lets threads wait for a condition to become true.
What do wait() and signal() do for a condition variable?
wait() waits for a condition; signal() wakes a waiting thread.
What is a semaphore?
An integer-valued synchronization object used to coordinate threads and access to shared resources.
What does sem_wait() do?
Decrements the semaphore and blocks if a resource is unavailable.
What does sem_post() do?
Increments the semaphore and wakes a waiting thread if needed.
What initial semaphore value makes it act as a lock?
1, so only one thread can enter the critical section at a time.
What initial semaphore value makes a parent wait for a child to finish?
0; the parent calls sem_wait() and the child calls sem_post() when finished.
What if the parent calls sem_wait() before the child signals?
The parent blocks until the child calls sem_post().
What if the child calls sem_post() before the parent waits?
The semaphore becomes 1, so the parent later passes sem_wait() without blocking.
Does using a mutex or semaphore automatically prevent deadlock?
No. Incorrect lock ordering can still cause deadlock.
What is deadlock?
A situation where threads wait indefinitely for resources held by one another.
What is cooperative CPU scheduling?
Processes voluntarily yield the CPU so another process can run.
Why can cooperative scheduling be problematic?
A process that never yields can keep others from running.
What is starvation?
A process waits indefinitely because other processes keep receiving CPU time or resources.
Why are SJF and STCF difficult to use perfectly?
They require predicting CPU job lengths, which is difficult to do accurately.
What does SJF stand for?
Shortest Job First; it runs the shortest job first.
What does STCF stand for?
Shortest Time to Completion First; it runs the job with the least remaining time and can preempt.
How does Round Robin scheduling work?
Each ready process runs for a time quantum, then goes to the end of the queue if unfinished.
What is a time quantum?
The maximum CPU time a process receives in one Round Robin turn.
What is a typical Round Robin quantum in the review?
About 10–100 milliseconds.
What happens if the Round Robin quantum increases?
Interactive response time generally worsens because other processes wait longer.
What happens if the Round Robin quantum decreases?
Response time can improve, but context-switch overhead increases.
What does a very large Round Robin quantum resemble?
FIFO (First In, First Out) scheduling.
What is the maximum wait before a turn for n ready jobs with quantum q?
(n - 1) × q, under the review’s assumptions.
What is response time?
Time from job arrival to its first CPU execution: first start - arrival.
What is turnaround time?
Time from job arrival to completion: completion - arrival.
What worst-case average response-time expression is PRINTED on the review slide?
((N - 1) × q) / N. Note: this conflicts with the worked example.
What average first-response-time formula matches the worked Round Robin example?
((N - 1) × q) / 2 for N simultaneous jobs each using a full first quantum.
With four simultaneous jobs and q = 100 ms, what is average response time?
(0 + 100 + 200 + 300) / 4 = 150 ms.
With four simultaneous 10-second jobs and q = 100 ms, what is average turnaround time?
(39.7 + 39.8 + 39.9 + 40.0) / 4 = 39.85 seconds, ignoring context-switch overhead.
How does Multilevel Feedback Queue (MLFQ) scheduling work?
It uses multiple priority queues and adjusts job priorities based on CPU use; periodic boosts prevent starvation.
MLFQ Rule 1: Which process runs when priorities differ?
The higher-priority process runs.
MLFQ Rule 2: What happens when jobs have equal priority?
They share the CPU using Round Robin within that queue.
MLFQ Rule 3: Where does a new job start?
In the highest-priority queue.
MLFQ Rule 4: When does a job move down a queue?
After using its allotted CPU time at that priority level.
MLFQ Rule 5: What happens after time period S?
All jobs are boosted to the highest-priority queue.
Why does MLFQ periodically boost priorities?
To prevent starvation and ensure lower-priority jobs eventually receive CPU time.