Sei sulla pagina 1di 9

SHANMUGHA ARTS, SCIENCE, TECHNOLOGY & RESEARCH ACEDEMY SASTRA UNIVERSITY

(A University Established under section 3 of the UGC Act, 1956)

TIRUMALAISAMUDRAM, THANJAVUR - 613401

BCSCCS406R02 / BICCIC 406 R02 / BITCIT 406 R02 / Operating Systems Lab

Prepared By Shri D.Manivannan / Smt S.Samundeeswari / Shri B.Karthikeyan

BCSCCS 406 R02

OPERATING SYSTEMS LAB L T P CREDITS 0 0 3 2

1. 2. call. 3. 4. 5. 6. 7. a. b. c. 2. a. 3. a. 4. 5. 6. 7. a. 8. a. 9.

Write a C program that illustrates the execution of two commands concurrently with a command pipe. Write a C program that illustrates the creation of child process using fork system Write a C program that implements a producer-consumer system with two processes Write a C program that implements a Reader- Writer problem. Write a C program that implements a Dining Philosopher Problem. Write a C program that illustrates inter process communication using shared memory system calls. Write a C program that illustrates the following : Creating a message queue. Writing to a message queue. Reading from a message queue. Simulate the following CPU scheduling algorithms : Round Robin Sequential b) SJF b. Indexed c) FCFS d) Priority c. Linked Simulate the following File Allocation strategies : Simulate MVT and MFT Simulate Bankers Algorithm for Dead Lock Avoidance. Simulate Bankers Algorithm for Dead Lock Detection. Simulate the following File Organization Techniques : Single level directory b) Two level c) Hierarchical d) DAG Simulate the following Page Replacement algorithms : FIFO b) LRU c) LFU Simulate Paging Technique of Memory Management.

1. Creation of a child process using fork system call


Objective: To create a child process using fork system call. Procedure: Create one child process using Fork(). Display the parent process ID and child process ID. Differentiate parent and child process. Pre-Lab Prior Knowledge on Pipe concept in Linux environment Client Server Communication File Operation

2. Implementing Producer-Consumer system


Objective: Implementation of Producer-Consumer system. Procedure: Create a producer which produce the product by increasing the FillCount and decreasing the EmptyCount Create a consumer which consume the product by decreasing the FillCount and increasing the EmptyCount Both producer and consumer must check the MAX_BUFFER to produce and consume respectively. Pre-Lab: Process Synchronization.

3. Implementing Reader-Writer problem


Objective: To write a code to solve the readers writers problem using semaphores. Procedure: Many processes share a database Some processes write to the database Only one writer can be active at a time Any number of readers can be active simultaneously This problem is non-preemptive Wait for process in critical section to exit Pre-Lab : Knowledge on semaphore.

4. Implementing Dining Philosopher problem


Objective: To write a code to solve the Dining Philosopher problem. Procedure: Array of semaphores are used to keep track of whether a philosopher is eating, thinking or hungry (trying to acquire the fork). A philosopher may move only into the eating state if neither neighbor is eating. Before starting, to acquire the fork, a philosopher would do a DOWN on mutex. After replacing the forks, he would do an UP on mutex. Pre-Lab: Prior knowledge of Concurrent Programming Mutual Exclusion

5. Inter-Process Communication using Shared Memory System Call


Objective: To write a code to implement IPC using pipes Procedure: Create the server process and create the shared memory portion using shmget() function. Attach the shared memory segment to data space and assign the shared memory a key value say 1234. Write some data into the shared memory. Create the client process. Obtain the shared memory by passing the corresponding key value 1234. Attach the shared memory segment using shmat() function. Read the data put by server in the memory. Alter a character as an acknowledgement for having read the data. Pre-Lab Knowledge on shmat(), shmget() functions.

6. Working with Message Queues


Objective: To implement message queues . Procedure: queue reader reads the messages from the queue prints their contents to standard output. The "queue_reader" is given a number on its command line, which is the priority of messages that it should read. queue sender creates a message queue, and then starts sending messages with different priorities onto the queue. Pre-Lab : Msgget() -Creating A Message Queue Msgsnd() -Writing Messages Onto A Queue Msgrcv() - Reading A Message From The Queue

7. Simulate CPU Scheduling algorithms


Objective: Simulation of CPU Scheduling algorithms. Procedure: Input the number of processes (p1, p2, pn) Input the CPU process time for each of the process. Calculate the waiting time and the average waiting time of all the process for the following scheduling types: First Come First Serve (FCFS): Process execution based on the order of arrival of process. Shortest Job First (SJF): Process execution one by one based on lowest process time. Priority: Process execution based on the priority set for all the process. Pre-Lab: Prior knowledge of Waiting Time, Burst Time and Average Waiting Time calculation for all the CPU Scheduling algorithms.

8. Simulate File Allocation strategies


Objective: Simulation of File Allocation strategies. Procedure: Create a Record and store the contents in the file. Create fixed sized blocks (arrays and structures). Sequential Allocation: Records are stored in contiguous blocks. Linked Allocation: Records are stored in free blocks and address of next block is stored at the end of the block. Pre-Lab: Prior knowledge of Storage Schema of all File Allocation methods. File operations fopen(), fseek(), ftell(), rewind(), fscanf(), etc,.

9. Simulate MVT and MFT


Objective: Simulation of Multiprogramming with Variable and Fixed number of Tasks. Procedure: Create various Tasks (copying file contents, storing information in editor and drawing a picture, etc,.). Execute the Tasks at an interval of time to implement MVT. Get the opinions to execute notepad, paint application for fixed number of tasks (MFT). Pre-Lab: Multiprogramming concepts.

10. Simulate Bankers Algorithm for Dead Lock Avoidance & Avoidance
Objective: Simulate Bankers Algorithm for Dead Lock Avoidance Procedure: Get the number of processes and resources Create the following data structures: Available Number of available resources of each types. Max Maximum demand of each process. Allocation Number of resources of each type currently allocated to each process. Need Remaining resource need of each process. (Max-Allocation) Use Safety algorithm and Resource-Request algorithm. Pre-Lab: Prior knowledge of deadlocks and all deadlock avoidance methods.

11. Simulate File Organization techniques


Objective: Simulation of File Organization techniques. Procedure: Single Level Directory: Displays the directory and the files present in a drive. Two Level Directory: Displays the directory, the subdirectories and the files present in a drive. Hierarchical Directory: Displays all the files, subdirectories and the directories present in a drive in a tree format. DAG: Have Shared subdirectories and files. Pre-Lab: Prior knowledge of Types of directory levels. Usage of File class and the associated methods of a File class.

12. Simulate Page Replacement algorithms


Objective: Simulate Page Replacement algorithms. Background: First In First Out: Associates time when page is loaded to memory. Older pages are replaced during page replacement. Least Recently Used: Associates with each page the time of that pages last use. During replacement, the page that has not been used for the longest period of time is chosen. Least Frequently Used: Counts, how often an item is needed. Those that are used least often are discarded first. Pre-Lab : Knowledge on all types of page replacement algorithms. Array and Structure usage.

13. Simulate Paging technique of Memory Management


Objective: Simulation of Paging technique of Memory Management. Procedure: Get the range of Physical and Logical addresses. Get the Page Size. Get the Page Number of the data. Construct Page Table by mapping Logical address to Physical address. Search Page Number in the Page Table and locate the Base Address. Calculate the Physical address of the data as: Physical Address = Logical Address + Offset. Pre-Lab: Prior knowledge on Paging, Physical Address and Logical Address.

******

Potrebbero piacerti anche