Font size
WorksheetsCPE333 Operating System
Total questions: 36
Worksheet time: 18hrs 0mins
What is not true about concurrency?
Operating system can run many processes at the same time on multi-core processor
Operating system can run many threads at the same time on multi-core processor
Memory of a process cannot be shared with other processes
When a process has several threads, race condition might occur
Only one process can be executed on a core of a processor at one time
What is not true about thread?
Each thread has separate address spaces
Each thread has its own PC
All threads share resource with in a process
OS also needs to context-switch threads
Thread shares data but has separate stack
What is not true about race condition?
To prevent race condition, mutex must be guaranteed when critical region is entered
Mutex allows one of several threads to enter a critical region
Race condition makes process runs faster
Race condition might occur when threads share resources
Race condition will not occur if one thread is running at a time
Which of the following statements cannot be a critical region?
A region that allows multiple processes to access shared resources simultaneously without synchronization.
A region where only one process can execute at a time to access shared resources.
A region protected by mutual exclusion mechanisms.
A region that prevents race conditions by controlling process access.
Which system call can cause the main thread to wait for child thread to terminate?
pthread_cond_wait
pthread_join
pthread_create
pthread_cond_init
pthread_mutex_init
What is not true about lock?
compare_and_swap is a hardware lock
Spin lock wastes CPU cycles waiting
Software test and set is not correct
We can create pure software lock
We can you interrupt to create lock
What is true about lock?
Fetch and add does not know the order of lock request
Compare-and-swap is fairer than test-and-set
What is the software not a support to solve wasting cycles with lock?
Sleep instead of spin
Yield system call
Park when lock
Using waiting queue for lock request
All are software supports to solve wasting cycles
What is not true about bounded buffer problem?
The program does not work with one conditional variable
Producer is waiting on empty condition
Consumer is waiting on full condition
Mutex is used to count available items
You need all mutex, full, and empty
What does a producer call when it produces something?
mutex_lock(&mutex)
mutex_unlock(&mutex)
cond_signal(&fill)
cond_signal(&empty)
What does a consumer call when it consume something?
mutex_lock(&mutex)
mutex_unlock(&mutex)
cond_signal(&fill)
cond_signal(&empty)
cond_wait(&fill,&mutex)
What is true about semaphore?
There are binary and continuous semaphore
When sem_post is called, value is decreased by 1
When sem_wait is call, value is increased by 1
Semaphore value can only be 0 and 1
Semaphore can be used to create mutex
Which statement is not true?
Each resource types only have one instance
A process has to request for a resource before use
A process needs to hold a resource while using it
When a process finish the task, resources can be released
A process cannot hold processor
Which problem does cause by resource allocation?
Race condition
Deadlock
Trashing
Internal fragmentation
Zombie
What is true about deadlock?
A deadlock needs more than one process to occur
Deadlock will occur when many processes are waiting for CPU
Deadlock will occur when virtual memory is running low
Deadlock will occur if process need to hold resources and wait for other resources
Deadlock will occur even there is only one resource type
What is not the four conditions of deadlock?
Mutual exclusion
Non-preemption
Virtualization
Hold and wait
Circular wait
When does a deadlock might occur?
A deadlock will never occur with which deadlock management?
Prevention
Avoidance
Detection
Both prevention and avoidance
Deadlock will occur in all management
Which deadlock management needs recovery?
Prevention
Avoidance
Detection
Both prevention and avoidance
All managements need recovery scheme
Which problem does requesting resource in increasing order would solve?
No preemption
Hold and wait
Which of the following is a necessary condition for deadlock?
Mutual exclusion
Circular wait
Starvation
Which method can solve no preemption?
test_and_set
yield
try_lock and try_wait
fetch_and_add
request resource in increasing order
What is not true about Banker's algorithm?
Process must declare maximum number of resources
Deadlock might occur in safe state
Need is Max minus allocation
Deadlock will occur in unsafe state
Request can be granted if resource left is more than needed resource
What could deadlock recovery do?
Deny request
Terminate processes
Preempt resource from process
Put process on wait queue
Which statement is not true?
Wait-for graph is equivalent to resource allocation graph
Resource allocation graph is used in deadlock avoidance
Resource allocation graph is used in deadlock detection
There is no resource in wait-for graph
Deadlock occurs when there is a loop in wait-for graph
Which method is when the device-registers are mapped into the memory space of the system?
System call
Interrupt
Direct memory access
Memory-Mapped I/O
Pooling
Which statement is not true?
Pooling is the most efficient method to access IO
Interrupt can be hardware and software
Interrupt frees up processor to do something else
DMA moves data from device directly into memory
Interrupt vector table stores locations of service routines
Which layer knows how to read and write specific block of device?
Application layer
File system
Generic block layer
Device driver
All layers can directly read and write blocks on device
Which Disk Scheduling Algorithms might cause starvation?
FCFS
SSTF
SCAN
LOOK
No starvation in disk scheduling
Which Disk Scheduling Algorithms does sweeps from the outer to inner track and then back to the outer, again?
FCFS
SSTF
SPTF
SCAN
LOOK
What is not true about RAID
RAID 1 is _________
mirror with no stripping
striping with no mirroring
parity with striping
single disk storage
RAID 2 is _________
has error correcting code
uses mirroring only
is not fault tolerant
uses only striping
RAID 3 is _________
Bit-striping and dedicated parity disk
Block-striping and distributed parity
Mirroring with no parity
Block-striping with no parity
RAID 4 is _________
Block-striping and block-mirroring
Bit-level striping with parity
Block-level striping with dedicated parity
Mirroring with distributed parity
Which file allocation method is FAT?
Linked allocation
Contiguous allocation
Indexed allocation
Multi-level indexed allocation
Combined scheme
