CS9227 OPERATING SYSTEM LAB SYLLABUS | OPERATING SYSTEM LAB CS9227 SECOND SEMESTER ME SYLLABUS
CS9227 OPERATING SYSTEM LAB
MULTIPROCESSOR OPERATING SYSTEMS
PROGRAM 1 – Semaphores - Multiprocessor operating systems
Assume there are three processes: Pa, Pb, and Pc. Only Pa can output
the letter A, Pb B, and Pc C. Utilizing only semaphores (and no other variables) the processes are synchronized so that the output satisfies the following conditions:
a) A B must be output before any C's can be output.
b) B's and C's must alternate in the output string, that is, after the first B is output, another B cannot be output until a C is output.
Similarly, once a C is output, another C cannot be output until a B is output.
c) The total number of B's and C's which have been output at any given point in the output string cannot exceed the number of A's which have been output up to that point.
AACB -- invalid, violates a)
ABACAC -- invalid, violates b)
AABCABC -- invalid, violates c)
AABCAAABC -- valid
AAAABCBC -- valid
AB -- valid
PROGRAM 2 – Multithreading - Multiprocessor operating systems
The Cigarette Smokers Problem
Consider a simulation with three smoker threads and one agent thread. Each smoker continuously makes a cigarette and smokes it. But to make a cigarette, a smoker needs three ingredients: tobacco, paper, and matches. One of the smoker threads has only paper, another has only tobacco, and the third has only matches. The agent thread has an infinite supply of all three materials. The three smoker threads are initially blocked. The agent places two randomly chosen (different) ingredients on the table and unblocks the one smoker who has the remaining ingredient. The agent then blocks. The unblocked smoker removes the two ingredients from the table, makes a cigarette, and smokes it for a random amount of time, unblocking the agent on completion of smoking the cigarette. The agent then puts out another random two of the three ingredients, and the cycle repeats. Write a multi-class multithreaded Java program that uses a monitor to synchronize the agent thread and the three smoker threads. Do not mechanically translate semaphore code into monitor code! The agent thread executes in an agent object created from an agent class. Each smoker thread executes in a smoker object. All smoker objects are created from one smoker class whose constructor is used to specify the ingredient possessed by the smoker object. A driver class with a main method constructs the objects and starts the threads. Use a single monitor object instantiated from a class Control for synchronization. Each of the four threads invokes a synchronized monitor method for its synchronization. No semaphores are allowed. No synchronized blocks are allowed, only synchronized methods. No busy waiting is
allowed. No calls to nap inside a synchronized method are allowed (do not nap while holding the monitor object's lock, that is, while inside a synchronized method or while inside a method called by a synchronized method).
PROGRAM 3 – Multiple sleeping barbers - Multiprocessor operating systems
Write a multi-class multithreaded Java program that simulates multiple sleeping barbers, all in one barbershop that has a finite number of chairs in the waiting room. Each customer is instantiated from a single Customer class, each barber is instantiated from a single Barber class. Network operating systems
PROGRAM 4 – Network operating systems Establish a Lab setup for the following network operating systems based programs based on the skills in networking on your own. E.g. for identifying networking hardware, identifying
different kinds of network cabling and network interface cards can be done.
1. Identifying Local Area Network Hardware
2. Exploring Local Area Network Configuration Options
3. Verifying TCP/IP Settings
4. Sharing Resources
5. Testing LAN Connections
6.Real time operating systems
PROGRAM 5 – Real time operating systems
A real-time program implementing an alarm clock shall be developed.
[Alarm clock, using C and Simple_OS]
The program shall fulfill the following requirements:
Clock with alarm functionality shall be implemented, It shall be possible to set the time, It shall be possible to set the alarm time, the alarm shall be enabled when the alarm time is set, the alarm shall be activated when the alarm is enabled, and when the current time is equal to the alarm time, an activated alarm must be acknowledged. Acknowledgement of an alarm shall lead to the alarm being disabled, the alarm is enabled again when a new alarm time is set, an alarm which is not acknowledged shall be repeated every 10 seconds. The program shall communicate with a graphical user interface, where the current time shall be displayed, and where the alarm time shall be displayed when the alarm is enabled. It shall be possible to terminate the program, using a command which is sent from the graphical user interface. Database operating systems
PROGRAM 6 – Transactions and Concurrency -Database operating systems
Assume any application(e.g.banking) on your own and do the following exercises.
1. Investigate and implement the ObjectStore's concurrency options.
2. Implement the concurrency conflict that occurs between multiple client applications.
3. Observe and implement the implication of nested transactions. Distributed operating systems
PROGRAM 7 – Distributed operating systems
1. Design a RMI Lottery application. Each time you run the client program -- “java LotteryClient n”, the server program “LotteryServer” will generate n set of Lottery numbers. Here n is a positive integer, representing the money you will spend on Lottery
in sterling pounds. Write this program in a proper engineering manner, i.e. there should be specifications, design (flow chart, FD, or pseudo code), coding, test/debug, and documentation.
2. Consider a distributed system that consists of two processes which communicate with each other. Let P be a state predicate on the local state of one process and Q be a state predicate on the local state of the other process. Assume that neither P nor Q are stable
Design a superimposed computation which detects that there exists an interleaving of underlying events in this system where at some state P ^Q holds. (A superposed computation is one that does not a_ect the underlying system; it may \read" but not \write" the state of the underlying system. Events in a superposed computation may
occur in at the same instant as the underlying events and/or at di_erent instants.) State any assumptions you make.
[Hint: Use vector clocks.]