THINK FIRST·CODE LATER

← Operating Systems
Chapter 3 · Week 3

Processes, Threads and Resource Management

Answered 0/30 Correct 0
Sign in to save progress across devices
Q1

Which resource is preemptable?

Q2

A message sent from one process to another is used up when it is received. It is a…

Q3

What is the difference between a program and a process?

Q4

Where are a function's local variables and return address stored?

Q5

Which item is not normally stored in a process control block?

Q6

A running process requests to read a file from disk. Which state does it move to?

Q7

The disk read of a blocked process completes. What happens next?

Q8

Which transition is invalid in the five-state model?

Q9

A running process's time slice expires. Which transition occurs?

Q10

Memory is full, and the OS moves a blocked process's memory to disk. Which state does it enter?

Q11

The time slice is q = 1 ms and a context switch costs s = 0.1 ms. What fraction of CPU time is useful work?

Q12

20 processes take turns with q = 10 ms and s = 0.1 ms. What is the maximum time a process may wait before its next turn?

Q13

Why is a context switch considered overhead?

Q14

What does fork() return in the child process?

Q15

How many times is "hi" printed?

fork();
fork();
fork();
printf("hi\n");
Q16

How many new processes (not counting the original) are created by for (i = 0; i < 4; i++) fork();?

Q17

What does execve do?

Q18

ps shows many processes in state Z. What is the most likely cause?

Q19

Which is shared among the threads of one process?

Q20

A program uses many user-level threads mapped onto a single kernel thread (many-to-one). One thread makes a blocking disk read. What happens?

Q21

Which threading model do Linux and Windows use for ordinary threads?

Q22

Why do web and edge servers use a thread pool instead of creating one thread per request?

Q23

One thread in a process dereferences a null pointer and crashes. What happens to the other threads of the same process?

Q24

Where does an object created with new in Java (or malloc in C) live?

Q25

Java 21 virtual threads let a server run a million concurrent tasks on a few kernel threads. Which threading model is this closest to?

Q26

Which Linux mechanism limits the CPU and memory usable by a group of processes (the basis of container resource limits)?

Q27 Short answer

Draw (in words or ASCII) the process state diagram with seven states (new, ready, running, blocked, terminated, suspended-ready, suspended-blocked) and name the event for each transition.

Q28 Short answer

A time-sharing server runs 12 interactive processes. The context-switch cost is 0.2 ms. Compute the CPU efficiency and the worst-case wait before a process runs again for q = 2 ms and q = 20 ms. Which q would you choose if users need a response within 100 ms?

Q29 Short answer

Explain what a zombie process and an orphan process are, how each arises, and how the OS deals with each.

Q30 Short answer

EdgeCampus runs a video-analytics service that handles 40 camera streams. Compare three designs: (a) one process per camera, (b) one process with one thread per camera, (c) one process with a thread pool of 8 workers. Discuss isolation, memory, CPU use on an 8-core server and behaviour under failures.