Concurrency and Parallelism: True/False Questions and Answers

Concurrency and Parallelism: True/False Questions

– In a single-processor environment, the processes of a parallel program may interleave or overlap their instructions, and the final decision (regarding whether instructions interleave or overlap) is taken by the scheduler. FALSE

– In single-processor environments, concurrent programs behave deterministically. FALSE

– In a single-processor environment, non-determinism can cause a concurrent program to yield different results in different executions that take the same input data. TRUE

– In a single-processor system, if the scheduler could not move a process from the running state to any other state while that process is executing a critical section, then interference would not arise. TRUE

– In a multi-processor system, if the scheduler could not move a process from the running state to any other state while that process is executing a critical section, then interference would not arise. FALSE

– “A process will not crash while in the critical section” is one of the assumptions in the Critical Section Problem. TRUE

– “A process may crash while executing the pre-protocol” is another of the assumptions in the Critical Section Problem. FALSE

– “Comparisons (like a==b) are atomic operations” is one of the assumptions in the Critical Section Problem. FALSE

– The “no process will crash while in the critical section” assumption in the Critical Section Problem, also includes the post-protocol. TRUE


– Two processes execute the same code, and this code reads a variable (the same variable for both processes). This code is never going to cause interference. TRUE

– One of the advantages of thread pooling is that it avoids the risk of interference. FALSE

– If critical sections are made non-interruptible (atomic), interference does not take place. TRUE

– If a concurrent program exhibits “liveness” then it is free from starvation TRUE

– Being starvation-free means that once a process has requested to enter the critical section, there is an upper limit for the times other processes will be granted access to this critical section. TRUE

– An asynchronous channel may, in some circumstances, block the sender. FALSE

– Asynchronous channels are entirely non-blocking. FALSE

– Asynchronous channels must have a buffer of unread messages. TRUE

– An asynchronous channel can block the sender but may never block the receiver. FALSE

– In channel-based asynchronous message passing, send and receive operations do NOT need to be atomic since they do not execute in shared memory. FALSE

– In channel-based asynchronous message passing, the atomicity of the send and receive operations is not guaranteed. FALSE

– The lock operation on a lock can only be invoked by the owner of the lock. FALSE

– A re-entrant lock can only be released by its owner. TRUE

– Invoking the lock() operation on a lock may perpetually block the invoker if it already owns the lock. TRUE


– A test-and-set variable is owned by the last process that set its value. FALSE

– In a boolean test-and-set variable, setting its value to false ends up in an error if the setting is not done through the test-and-set operation (the Java equivalent would be: the value of an AtomicBoolean can only be set to false through the compareAndSet method because otherwise an exception occurs) FALSE

– In java, the compareAndSet method of AtomicIntger objects can only be invoked by the owner of the object. FALSE

– If a thread th1 invokes th2.stop() (th2 being a different thread) then th1 stops itself. FALSE

– If th1 and th2 are Java Threads, th1 can stop th2 invoking th2.stop(). TRUE

– A java socket is the implementation of a two-way synchronous channel. FALSE

– In Java, the await operation on Condition objects blocks the invoker unconditionally. TRUE

– In Java, a synchronized(this){…} block never blocks the thread that tries to execute it. FALSE

– Signalling a semaphore with no processes in its waiting set has no effect. FALSE

– “Ownership” (as in a lock) does NOT apply to semaphores. TRUE

– Java Sockets are an implementation of two-way synchronous channels FALSE

– Remote Method Invocation is an asynchronous communication schema for distributed environments. FALSE


– In Binary semaphores, signalling when no process is waiting in it causes an error. FALSE

– In Mesa-style-monitors, signalled processes have priority over processes waiting to enter the monitor. TRUE

– In Mesa-style monitors, signalling a condition when no process is waiting in it causes an error. FALSE

– In a MESA-style monitor, when a process invokes the signalC operation it owns the lock and does not release it. TRUE

– In Java Monitors (implemented with Lock and Condition objects), signalled threads have priority over processes waiting to enter the monitor. FALSE

– In Java Monitors (implemented using Lock and Condition objects), a “spurious wakeup” occurs when a thread that is waiting in a certain condition becomes ready to reacquire the lock, even though it has not been signalled by any other thread. TRUE

– In monitors, signalling when no process is waiting causes an error. FALSE

– In a monitor, signalling a condition will make all the process waiting on that condition, if any, be moved to the waiting-to-reacquire-the lock state. FALSE

– The client/server pattern follows an asymmetrical naming approach. TRUE

– In client/server systems, “Conversational continuity” means that client can send several requests without having to establish a separate connection for each one. TRUE

– In a client/server architecture, the server does NOT need to know the identity of the clients beforehand. TRUE

– Java RMI is an implementation of a synchronous communication schema for distributed systems. TRUE


A4ZnLy57UPXkAAAAAElFTkSuQmCC

wcP1C5oE8NsMgAAAABJRU5ErkJggg==

wc23bWImmSWnQAAAABJRU5ErkJggg==


NYDCn1yNTp0AAAAASUVORK5CYII=

6ueOEXAAAAAElFTkSuQmCC PVJfFP4htgkAAAAAS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BQFBQBAQBAQBQSAmAv8Po9jFJNLWMzwAAAAASUVORK5CYII= ZBWpwZ+CVGMAAAAASUVORK5CYII=


–  “Incremental acquisition” is a necessary but not sufficient condition for deadlock. TRUE

– “The scheduler is fair” means that every process in the ready state gets a chance to execute. TRUE

“The scheduler is fair” means that there is an upper bound to the time a process is ready but not running. FALSE

– “Scheduler fairness” means giving all process the same number of opportunities to execute (even if those opportunities have different durations). FALSE

– “Freedom from individual starvation” means that any process requesting to enter the critical section must eventually succeed. TRUE

– Serialization means “avoiding the overlapping of certain parts of the code”. FALSE

– In concurrent programs, the absence of deadlock is a liveness property. TRUE

– A system that avoids circular waiting avoids deadlock even if it does not avoid incremental acquisition. TRUE

– Mutual exclusion guarantees that the order of execution of different tasks is always the same. FALSE

– Mutual exclusion can be implemented with semaphores, locks and monitors but cannot be implemented with test & set variables. FALSE

– Non-determinism can take place both in parallel (with several processors) and in concurrent environments (with a single processor). TRUE

– Thread pooling mechanisms are devised to help threads in sharing memory and exchanging messages. FALSE

– In java, volatile makes reading and writing simple-typed variables atomic. FALSE