by Zacharias @ http://inexactitu.de . February 24, 2011 . 1:06PM
1. Circle the following components of program state that are shared across threads in a multi-threaded process:
a. Register Values
b. Heap memory
c. Global values
d. Stack memory
e. Open Files
a, c, e.
Registers are part of the virtual CPU, as are stack and thread-private memory.
2. A good solution to the cirtical section problem included the condition of pregress, where each process waiting for entry to the critical section will be granted entry in order of arrival.
False.
Bounded waiting can be granted only after a certain amount of tried.
3. With user-level threads, thread control blocks are stored in memoery outside the kernel and managed in user mode.
True.
Everything that happens with management is done at user-level. The kernel doesn’t know about them. Only the process can manipulate them.
4. In an operating system that can schedule kernal level threads, there may be two independent thread scheduling mechanisms.
True.
There could be a user-level thread management system as well as the kernel’s.
5. A course-gained atomic action is one in which the statements in the critical section for a data item are designed so that the critical section cannot be executed concurrently with itself or other cirical sections for that data item.
True.
They are functionally indivisible. This is the def. of the critical path setion.
6. A thread pool is a collection of kernel threads, which can be created at process startup, reducing the real-time overhead of creating new application threads.
False.
When a user process creates a new thread, we’d like to map it to an existing kernel thread. The idea of pools is to have the threads already created, and it will map to a kernal thread. There is a delay involved with creating additional threads at the kernel level for user-level threads to map to.
7. Race conditions are possible in concurrent programs because of the unpredictable interleaving of atomic actions in the programs.
True.
Solve this and get a turing prize. Inturrupts aren’t serviced during atomic actions, for example.
8. In multithreaded programs, the kernel can inform an application about certain events using a proceadure known as an ______
upcall.
This sends a signal to the thread library to tell it to, for example, run another thread while that thread is locked. It is like a reverse
Not a signal, as they can/are be used for inter-process communication instead of an upcall, which is specific to threading. Also, the kernal can throw signals but not upcalls. The user-level thread library can receive signals, though.
9. Signals are delivered to a process, notifying it of the occurrence of an event, and synchronous signals are delivered to the thread running when the signal occurs.
True.
Async signals can be handled by any running thread.
Sync signals are in response to a failure (hardware-based): These are delivered to a running thread.
10. A successful call to an exec() function has a return to the calling program of a value 0, indicating no error.
False.
There is nobody to return to if you exec, exec overlays the running process (including, pid and other things, like file pointers)
by Zacharias @ http://inexactitu.de . February 15, 2011 . 1:02PM
1. The ready queue is essentially a linked list of the Process Control Blocks of all processes that have all required resources, except the CPU.
True
Don’t confuse this with the I/O queue.
2. I/O bound programs have a higher frequency of occurrence of large duration CPU bursts.
False
Why are they called I/O bound? Because they don’t need a lot of CPU (otherwise they’d be called CPU-bound)
3. The medium-term scheduler helps reduce the degree of multi-programming by removing partially executed processes from memory.
True
Three types- long term, medium, and short-term. The short term does most of the work, including choosing the next process to execute (by making the virtual CPU a real-life one).
The long term scheduler is in charge what processes can get some memory, thus being able to run.
Call the medium-term dude a “swapper” – there are two kinds of memory issues:
a. swapping – moving an entire program into/out of main memory. Due to low-priority or waiting for slow resources.
b. paging – this means the entire program/process isn’t moved – this is moving a part of it. There are two types of files: one is a “Swapped” file, and another is a page file. Swap files have partially-executed processes. The next time we run a process we don’t want just the partially-executed part. The OS manages the page files.
4. Hardware is a critical feature for preparing the CPU to begin the execution of interrupt servicing; because the state of the interrupted program could be destroyed by the interrupted service routine.
True.
Hardware needs to store at least where the prior process was. We need at least two pieces if info: the PSW and the program counter. The PSW can’t be stored by software.
5. Because of the overhead of context switching, programs that use concurrent processes will always take longer to execute than the same program with a single process.
False.
It takes longer to exec a context switch than not. IF a process blocks for I/O, another process gets to run. A program with multiple processes can perform other operations during I/O – i.e. while another process does I/O another process can do computational work. This allows less total time on the CPU overall, even with the overhead of context switching (especially if the two processes on one program share a lot of context).
6. To achieve high throughput, a multiprogramming OS assigns higher priority to CPU-bound programs.
False.
A compute-bound process will be a worse citizen if they never need to block for I/O. This means more leaving.
7. In general, CPU utilization increases as the degree of multiprogramming decreases.
False.
Programs naturally share the CPU if they’re waiting for I/O. The more multiprogramming, the less time the CPU is idle waiting for resources (i.e. disk access).
8. If we implement the consumer-producer problem with an unbounded bugger, we could expect that producter operations can always complete.
True
The unboundedness has no effect on the consumer.
9. Instructions like a ‘compare’ in assembly language, produce a side effect that saves the value of the arithmetic result in the PSW for use at a later time.
False.
Kind of tricky – Not the value. It does say if >0, overflow, etc, but not the value itself (look in the accumulator).
10. If a user program was able to access the processor status word for read and write, it would be able to ensure that it could keep control of the CPU forever.
True.
The CPU could always be “above” interrupts by default – if a user program is in charge of this it could exist in a state of highest priority.