Andy presented another high paced lecture this week, the theme was Deadlock and Inter-Process Communication. This is a continuation of the Process Management topic from last week.

As a recap:

  • Deadlocks: Can occur on any multitasking O/S where a single process is given exclusive access to a file, device or resource. Detailed conditions:
    • Mutual Exclusion – One process can hold a resource exclusively
    • Hold and Wait – A process can request a new resource over time whilst still holding other resources.
    • No pre-emption – resources can only be released by the program that is holding them
    • Circular Wait – 2 or more processes waiting for resources held the other processes.

Dealing with deadlocks has 4 options; Ignore issue, Detection & Recovery, Prevention (eliminating one of the 4 conditions above from being possible), Avoidance (ie: bankers algorithm).

The next slide introduced Semaphores which are in basis an encoded binary gate that prevents any non-sharable resources from being accessed by more than 1 process at a time. With a semaphore a queue would also need to be implemented to allow programs to submit requests then continue processing other threads whilst the request was waiting.

Inter-Process Communication [IPC] was the next topic, Andy outlined the types of IPC:

  • Semaphores
  • Pipes (used in command line |, One Way, FIFO, Kernel controlled output flow.)
  • Message Queues (like a forum for processes)
  • Shared Memory (very efficient but hard to implement, if one process is reading a memory page and another needs to edit it)

The following 3 hour tutorial was all about file sharing. Unix systems, particularly Ubuntu are very easy to configure for file sharing both UNIX – UNIX and UNIX – Windows. Below are the steps to configuring NFS (UNIX) and then SAMBA (Windows):

NFS

SAMBA

Samba seems to be very well put together and after using it a few times in the past I am yet to have any issues with it.