These are two sample questions that could
have appeared in a 531 exam
A multiprocessor operating system provides spin locks using the following routines:
sp_lock(int x) : locks x, and if x is already locked then
the routine spins till the lock is obtained
sp_unlock(int x) : unlocks x
We are provided with routines that do blocking and unblocking. These routines are re-entrant are:
block(queue Q):blocks the current process
and places the PCB on Q
unblock(queue Q):unblocks one process from
Q
Now we want to define a barrier
operation:
barrier ( barriertype B);
To use the barrier, a field in B is initialized to the number of
processes that synchronize on the barrier. Then each process calls the barrier
and all block till the last process to arrive frees them all up.
Hint: You need to define the type
barriertype, and this can be a struct with an int and a queue.
MPI is a message-passing package that can be thought of a library that supports the following functions:
MPI_spawn(processor and arguments): create a process on a specified processor.
MPI_Send(where and what) : send a message to a port
MPI_Recv(from where and what): receive a message from a port
The MPI package can be used to write concurrent or parallel programs that run on UMA machines as well as NUMA machines (as well as distributed systems - but we are not considering that in this question).
A. Briefly, state how MPI is used on NUMA machines to write programs.
B. Can parallel programs be written on UMA machines without the use of MPI. Show how, and describe what facility (other than MPI and regular sequential programming) would be needed.
C. What are the advantages of using MPI on UMA machines (over the scheme outlined in your answer for (B)).
D. What are the disadvantages of using MPI on UMA machines (over the scheme in (B)).