Exam OS1 (1DT044) / OSPP (1DT096), 2018-03-16 Mixed concepts K - wait() O - signal G - SJF - Cache - Shell H - Many-to-one L - Operating system B - Critical section Q - Peterson's solution C - Paging S - Response time A - System call I - fork() T - External fragmentation D - Translation Lookaside-Buffer (a _cache_) E - Context switch N - pipe() R - Throughput P - Race condition - Deadlock avoidance F - Time slicing / multitasking / Round-Robin J - exec() M - Message Passing (For *Shared Memory* conflicts need be avoided.) - File Allocation Table Module 1 1.1 B 1.2 D 1.3 A 1.4 C 1.5 C Module 2 2.1 D 2.2 Ready Running Terminated Waiting 2.3 a) fork() b) exec() d) exit() c) wait() 2.4 I/O completes (event) I/O request time slice expires (interrupt) fork a child 2.5 D 2.6 A Module 3 3.1 C 3.2 D 3.3 Avereage response time = 0 + (2-1) + (5-4) + (11-8) 5 = --------------------------- = --- = 1,25 4 4 Avereage waiting time = (4-2 + 15-5) + (2-1 + 9-4 + 16-11) + (5-4) + (11-8 + 18-15) 30 = ----------------------------------------------------------- = ---- = 7,5 4 4 3.5 Preemptive Shortest Job First: --------------------------------------------------------------------------------- | P1 | P2 | P3 | P4 | P1 | |___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___| 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Round-Robin, quantum = 3: --------------------------------------------------------------------------------- | P1 | P2 | P1 | P3 | P2| P4 | P1 | P4 | |___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___| 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Module 4 4.1 B 4.2 Mutual exclusion Hold and wait No preepmtion Circular wait 4.3 D 4.4 C 4.5 (First of all find totally available and then check at the end.) Fill in the need matrix (1 pt): | A | B | C | D | T0 | 2 | 4 | 6 | 0 | T1 | 0 | 2 | 0 | 0 | T2 | 2 | 0 | 0 | 1 | T3 | 0 | 5 | 7 | 0 | T4 | 0 | 0 | 0 | 0 | Determine whether the state is safe by showing each step of the Banker’s algorithm using the available matrix and choice vector. (1 pt): | Available | Step | A | B | C | D | Choice 1 | 0 | 2 | 5 | 1 | T4 2 | 2 | 3 | 5 | 1 | T1 3 | 4 | 6 |11 | 1 | T3 4 | 4 | 6 |11 | 2 | T0 5 | 8 | 7 |11 | 2 | T2 Total|12 |12 |14 | 3 | - OK! -- OR --: | Available | Step | A | B | C | D | Choice 1 | 0 | 2 | 5 | 1 | T1 2 | 2 | 5 |11 | 1 | T0 3 | 6 | 6 |11 | 1 | T2 4 |10 |11 |14 | 2 | T3 5 |10 |11 |14 | 3 | T4 Total|12 |12 |14 | 3 | - OK! Determine whether the state is safe by showing each step of the Banker’s algorithm using the available matrix and choice vector. (1 pt) - Yes. It is safe to run. The vector of totally available is = <12,12,14,3>. Module 5 5.1 C 5.2 4 GiB 256 MiB 4 KiB 5.3 A 5.4 B