Operating Systems Midterm Review

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/87

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 9:58 PM on 10/15/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

88 Terms

1
New cards

What is an operating system?

Software that manages hardware and software resources and provides services for programs.

2
New cards

Why do operating systems exist?

To manage resources, run programs, and make computers easier and safer to use.

3
New cards

What are examples of operating system environments?

Desktop computers, servers, mobile devices, embedded systems, and real-time systems.

4
New cards

What services does an OS provide?

Program execution, I/O, file management, process communication, resource allocation, and security.

5
New cards

What is user mode?

A restricted execution mode for regular applications.

6
New cards

What is kernel mode?

A privileged mode where the OS can access protected hardware and perform privileged operations.

7
New cards

How does a program request a privileged OS service?

Through a system call, which traps into kernel mode.

8
New cards

What is a system call?

An interface that lets a program request services from the operating system.

9
New cards

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.

10
New cards

What is the Unix root directory?

/ — the top of the filesystem hierarchy.

11
New cards

What is /home used for?

User home directories.

12
New cards

What is /bin used for?

Essential commands.

13
New cards

What is /etc used for?

System configuration files.

14
New cards

What is /tmp used for?

Temporary files.

15
New cards

What is /usr used for?

User utilities and applications.

16
New cards

What is /var used for?

Variable data such as logs.

17
New cards

What are privileged operations?

Operations requiring kernel mode, such as protected hardware access, process management, and protected file operations.

18
New cards

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.

19
New cards

What happens when an interrupt occurs?

Control transfers to the handler address listed in the trap table.

20
New cards

What is a timer interrupt?

An interrupt that gives the OS control so it can manage scheduling and potentially switch processes.

21
New cards

Why might interrupts be disabled while processing an interrupt?

To prevent interference from another interrupt during sensitive handler work, as described in the review.

22
New cards

What is a process?

A program that is currently executing.

23
New cards

What data structure represents a process?

The Process Control Block (PCB).

24
New cards

What important information is stored in a PCB?

Process state, PID, program counter, CPU registers, memory information, I/O status, and scheduling information.

25
New cards

What does the program counter store?

The address of the next instruction to execute.

26
New cards

What does a PID identify?

A unique process.

27
New cards

How does a Unix process create a child process?

By calling fork().

28
New cards

What does fork() do?

Creates a child process; the parent receives the child PID and the child receives 0; both continue after fork().

29
New cards

What is a context switch?

When the CPU stops running one process and starts running another.

30
New cards

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.

31
New cards

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.

32
New cards

What information does a TCB hold?

Thread state, program counter, stack pointer, and CPU state.

33
New cards

What do threads in the same process share?

Code and data; each has its own stack and program counter.

34
New cards

What are user-level threads?

Threads managed by a user-space thread library rather than individually by the kernel.

35
New cards

What are kernel-level threads?

Threads managed and scheduled by the OS kernel.

36
New cards

What is one advantage of user-level threads?

They are generally faster to create and manage.

37
New cards

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.

38
New cards

What is an advantage of kernel-level threads?

Other threads can run when one blocks, and threads can execute on multiple CPUs.

39
New cards

What is a bounded buffer?

A fixed-size storage area shared by producers and consumers.

40
New cards

What happens when a bounded buffer is full or empty?

Producers wait when full; consumers wait when empty.

41
New cards

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).

42
New cards

What is a named pipe?

A FIFO communication mechanism that can connect processes without a parent-child relationship.

43
New cards

What capabilities does the review attribute to named pipes?

Bidirectional communication and use by several processes.

44
New cards

What does atomic execution mean?

A set of operations acts as one indivisible unit without interference.

45
New cards

What is a race condition?

When a program result depends on the timing or order of concurrent execution.

46
New cards

What is mutual exclusion?

Ensuring only one thread or process accesses a protected critical section at a time.

47
New cards

What is a critical section?

Code accessing shared resources that requires synchronization.

48
New cards

What mechanisms can help prevent race conditions?

Mutex locks, semaphores, and other synchronization primitives.

49
New cards

What is a spin lock?

A lock where a waiting thread repeatedly checks whether the lock is available.

50
New cards

What are drawbacks of spin locks?

Busy waiting wastes CPU cycles; fairness is not guaranteed and starvation is possible.

51
New cards

What can avoid wasting CPU time through spin-lock busy waiting?

Blocking synchronization mechanisms, such as condition variables and semaphores.

52
New cards

What is a condition variable?

A synchronization mechanism that lets threads wait for a condition to become true.

53
New cards

What do wait() and signal() do for a condition variable?

wait() waits for a condition; signal() wakes a waiting thread.

54
New cards

What is a semaphore?

An integer-valued synchronization object used to coordinate threads and access to shared resources.

55
New cards

What does sem_wait() do?

Decrements the semaphore and blocks if a resource is unavailable.

56
New cards

What does sem_post() do?

Increments the semaphore and wakes a waiting thread if needed.

57
New cards

What initial semaphore value makes it act as a lock?

1, so only one thread can enter the critical section at a time.

58
New cards

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.

59
New cards

What if the parent calls sem_wait() before the child signals?

The parent blocks until the child calls sem_post().

60
New cards

What if the child calls sem_post() before the parent waits?

The semaphore becomes 1, so the parent later passes sem_wait() without blocking.

61
New cards

Does using a mutex or semaphore automatically prevent deadlock?

No. Incorrect lock ordering can still cause deadlock.

62
New cards

What is deadlock?

A situation where threads wait indefinitely for resources held by one another.

63
New cards

What is cooperative CPU scheduling?

Processes voluntarily yield the CPU so another process can run.

64
New cards

Why can cooperative scheduling be problematic?

A process that never yields can keep others from running.

65
New cards

What is starvation?

A process waits indefinitely because other processes keep receiving CPU time or resources.

66
New cards

Why are SJF and STCF difficult to use perfectly?

They require predicting CPU job lengths, which is difficult to do accurately.

67
New cards

What does SJF stand for?

Shortest Job First; it runs the shortest job first.

68
New cards

What does STCF stand for?

Shortest Time to Completion First; it runs the job with the least remaining time and can preempt.

69
New cards

How does Round Robin scheduling work?

Each ready process runs for a time quantum, then goes to the end of the queue if unfinished.

70
New cards

What is a time quantum?

The maximum CPU time a process receives in one Round Robin turn.

71
New cards

What is a typical Round Robin quantum in the review?

About 10–100 milliseconds.

72
New cards

What happens if the Round Robin quantum increases?

Interactive response time generally worsens because other processes wait longer.

73
New cards

What happens if the Round Robin quantum decreases?

Response time can improve, but context-switch overhead increases.

74
New cards

What does a very large Round Robin quantum resemble?

FIFO (First In, First Out) scheduling.

75
New cards

What is the maximum wait before a turn for n ready jobs with quantum q?

(n - 1) × q, under the review’s assumptions.

76
New cards

What is response time?

Time from job arrival to its first CPU execution: first start - arrival.

77
New cards

What is turnaround time?

Time from job arrival to completion: completion - arrival.

78
New cards

What worst-case average response-time expression is PRINTED on the review slide?

((N - 1) × q) / N. Note: this conflicts with the worked example.

79
New cards

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.

80
New cards

With four simultaneous jobs and q = 100 ms, what is average response time?

(0 + 100 + 200 + 300) / 4 = 150 ms.

81
New cards

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.

82
New cards

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.

83
New cards

MLFQ Rule 1: Which process runs when priorities differ?

The higher-priority process runs.

84
New cards

MLFQ Rule 2: What happens when jobs have equal priority?

They share the CPU using Round Robin within that queue.

85
New cards

MLFQ Rule 3: Where does a new job start?

In the highest-priority queue.

86
New cards

MLFQ Rule 4: When does a job move down a queue?

After using its allotted CPU time at that priority level.

87
New cards

MLFQ Rule 5: What happens after time period S?

All jobs are boosted to the highest-priority queue.

88
New cards

Why does MLFQ periodically boost priorities?

To prevent starvation and ensure lower-priority jobs eventually receive CPU time.