Categories
Computer Technologies and O/S

FIT9018: Week 7

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

$ sudo apt-get install nfs-kernal-server
$ sudo apt-get install nfs-common

$ sudo /etc/init.d/nfs-kernel-server start
$ sudo /etc/init.d/nfs-kernel-server stop
$ sudo /etc/init.d/nfs-kernel-server restart

$ sudo vim /etc/exports -> /home/mark/shared-folder 192.168.1.5   (ro,sync)
$ showmount -e

$ sudo mount -t nfs 192.168.1.4:/home/mark/shared-folder /home/HomePC/Desktop/LaptopFolder
$ df //show mounted

$ sudo umount 192.168.1.4:/home/mark/shared-folder

SAMBA

$ sudo apt-get install samba

$ sudo vim /etc/samba/smb.conf
            // in [global] section of conf file
            client plaintext auth = Yes
            //in Share Definitions
            [shared-folder]
             comment = My Shared folder
             read only = yes
             path = /home/mclaptop/shared-fold
             guest ok = yes

$ sudo smbpasswd -a mclaptop
$ sudo /etc/init.d/samba restart

$ sudo apt-get install smbfs //samba client
$ sudo mount -t smbfs //192.168.1.5/shared-fold /home/me/here  //(shared-fold in smb.conf)

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.

Leave a Reply

Your email address will not be published. Required fields are marked *