Concepts

Independent and collaborative processes

In a multiprogramming environment, two or more processes can be:

  • Independent – if they, from their creation to their termination, never explicitly interact.

    • Actually, there is an implicit interaction, as they compete for system resources.

    • ex: jobs in a batch system; processes from different users.

  • Cooperative – if they share information or explicitly communicate.

    • The sharing requires a common address space.

    • Communication can be done through a common address space or a communication channel connecting them.

Independent processes competing for a resource.

It is the responsibility of the OS to ensure the assignment of resources to processes is done in a controlled way, such that no information loss occurs.

In general, this imposes that only one process can use the resource at a time – mutual exclusive access.

The communication channel is typically a system resource, so processes compete for it.

Cooperative processes sharing information or communicating.

It is the responsibility of the processes to ensure that access to the shared area is done in a controlled way, such that no information loss occurs.

In general, this imposes that only one process can access the shared area at a time – mutual exclusive access.

The communication channel is typically a system resource, so processes compete for it.

Critical section

Having access to a resource or to a shared area actually means executing the code that does the access.

This section of code, called critical section, if not properly protected, can result in race conditions.

A race condition is a condition where the behavior (output, result) depends on the sequence or timing of other (uncontrollable) events.

  • Can result in undesirable behavior.

Critical sections should execute in mutual exclusion.

Deadlock and starvation

Mutual exclusion in the access to a resource or shared area can result in.

  • Deadlock – when two or more processes are waiting forever to access to their respective critical section, waiting for events that can be demonstrated will never happen.

    • Operations are blocked.

  • Starvation – when one or more processes compete for access to a critical section and, due to a conjunction of circumstances in which new processes that exceed them continually arise, access is successively deferred.

    • Operations are continuously postponed.

Last updated