0% found this document useful (0 votes)
12 views3 pages

Lab 12

Uploaded by

Fatima Malick
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

Lab 12

Uploaded by

Fatima Malick
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Department of Computing

CS 330: Operating Systems

BSCS-9ABC

Lab 12: Synchronized File Management System

CLO4 (Develop programs to interact with OS components through


its API)

Date: 28 December 2021 & 31 Januray 2021

Time: 10:00 AM – 1:00 PM & 2:00 PM – 5:00 PM

Instructors: Dr Sana Qadir & Dr Farzana Jabeen


Lab 12: Synchronized File Management System
Instructions
● YYou are allowed to form groups (3-4 students per group).
● The code should be developed within the team and any form of plagiarism will
automatically result in zero for both the groups involved without any questions asked.
● Each student is responsible for understanding the code being submitted under his or
her name. Division of work is not explicitly required; however, each group member
will be given average viva marks of the group. This implies that if a group member
gets zero in viva and another gets full marks then both will score 50%.
● The submission deadline is 10AM Tuesday 18 January (Section ABC). Viva will be
held on TEAMS on Wednesday and Thursday. Schedule will be shared later. .
● Any questions and comments on the lab must reach the FM/LE one day before the
deadline through email or in person meeting. No questions will be answered after the
said time.

Introduction
The purpose of this lab is to make the server built in lab 11 safe for multiple users.
Recap: in lab 11, you developed a server that provides remote access to the file system
developed in lab 9.
In this lab, we will protect the files from the readers-writers problem. The description of this
problem is available in section 7.1.2 of your textbook. You may use monitors, locks or
semaphore libraries provided by the APIs to implement the tasks.

Objectives
By the end of this lab you will have learned the practical uses of synchronization and
implemented it on the readers-writers problem.

Lab Task

Multiple threads can attempt to access files. You are required to implement mutual exclusion
for the access of files. There are two tasks and you may choose to complete any ONE task.

1. Implement a queue for readers. Multiple threads can attempt to read a file and some
can request a write.
○ You need to make sure that while a file is being read, no writer is allowed
(while maintaining the order of writes).
○ Any request to open a file in write mode means the file is considered to be in
active write mode until the user closes the file.
○ Similarly any request to open a file in read mode means the file is considered
to be in active read mode until the user closes the file.
○ Multiple users can read the file concurrently but writes must be mutually
exclusive.
2. Implement a limit on the number of usernames that can access a file.
2
○ Multiple users can access your system.
○ Any user may not access more than five files at one time (though, it is not
required that you implement any type of security).
○ If more than five requests are placed, then the requesting thread must wait.
○ Each file can only be accessed by three users (whether it be it for read or write
access).

Your system should implement all the Requirements listed in Lab 11.

Deliverables

1. The complete code


2. A sample data file (sample.dat) consisting of your output.
3. A user guide on how to use your system. The user guide must include a description of
your synchronised file management server system.

You might also like