CS 3733 Operating Systems: Assignment 5 - new Write all your programs under assign5. You need to implement this assignment using C with pthread library!!! (no Java) Objective · Learn and practice CPU...

1 answer below »
The text files should be hyperlinked into the document as well.



CS 3733 Operating Systems: Assignment 5 - new Write all your programs under assign5. You need to implement this assignment using C with pthread library!!! (no Java) Objective · Learn and practice CPU scheduling algorithms by implementing them · Learn and practice process/thread synchronization mechanisms by implementing them · Practice system calls and library functions Description In this homework, you are asked to implement a multithreaded program that will allow us to measure the performance (i.e., CPU utilization, Throughput, Turnaround time, and Waiting time in Ready Queue) of the four basic CPU scheduling algorithms (namely, FIFO, SJF, PR, and RR). Your program will be emulating/simulating the processes whose priority, sequence of CPU burst time(ms) and I/O burst time(ms) will be given in an input file. Assume that all scheduling algorithms except RR will be non-preemptive, and all scheduling algorithms except PR will ignore process priorities (i.e., all processes have the same priority in FIFO, SJF and RR). Also assume that there is only one IO device and all IO requests will be served using that device in a FIFO manner. -------------------------------------------------------------------------------------------------------------------------- Your program will take the name of the scheduling algorithm, related parameters (if any), and an input file name from command line. Here how your program should be executed: prog -alg [FIFO|SJF|PR|RR] [-quantum [integer(ms)]] -input [file name] The output of your program will be as follows: Input File Name : file name CPU Scheduling Alg : FIFO|SJF|PR|RR (quantum) CPU utilization : .... Throughput : .... Avg. Turnaround time : .... Avg. Waiting time in R queue : .... -------------------------------------------------------------------------------------------------------------------------- The input file is formatted such that each line starts with proc, sleep, stop keywords. Following proc, there will be a sequence of integer numbers: the first one represents the priority (1: lowest, ..., 5: normal, ..., 10: highest). The second number shows the number of remaning integers representing CPU burst and I/O burst times (ms) in an alternating manner. The last number will be the last CPU burst time after which that process exits. Following sleep, there will be an integer number representing the time (ms) after which there will be another process. So one of the threads in your program (e.g., FileRead_thread()) would be responsible for processing this file as follows. As long as it reads proc, it will create a new process and put it in a ready queue (clearly this process is not an actual one, it will be just a simple data structure (similar to PCB) that contains the given priority and the sequence of CPU burst and I/O burst times, and other fields). When this thread reads sleep x, it will sleep x ms and then try to read new processes from the file. Upon reading stop, this thread will quit. -------------------------------------------------------------------------------------------------------------------------- Here is a sample input file (copy/paste this to create an input1.txt you can create other similar files too): --------------------------------------------------------------------------------------------------------------------------- proc 1 7 10 20 10 50 20 40 10 proc 1 5 50 10 30 20 40 sleep 50 proc 2 3 20 50 20 proc 3 3 20 50 20 sleep 50 proc 2 3 20 50 20 stop -------------------------------------------------------------------------------------------------------------------------- In this program you need at least three threads: As described above, one thread (say FileRead_thread) will read the above file, create a process (not a real process just a data structure representing the characteristic of the process that will be emulated/simulated), and puts it in a ready queue. CPU scheduler thread will check ready queue; if there is a process, it will pick one according to the scheduling algorithm from ready queue and hold CPU resource for the given CPU burst time (or for quantum time if the scheduling algorithm is RR). That means CPU thread will simply sleep for the given CPU burst time to emulate/simulate the process. Then it will release CPU resource and put this process into IO queue (or ready queue if RR is used) or just terminate if this is the last CPU burst. Then CPU scheduler thread will check ready queue again and repeat the same for the next process. I/O system thread will check IO queue; if there is a process, it will sleep for the given IO burst time to emulate/simulate the usage of IO device. It then puts this process back into ready queue. Finally it will check IO queue and repeat the same .... --------------------------------------------------------------------------------------------------------------------------- Basically you will have at least the above mentioned three threads and the main one. These threads need to be synchronized as they cooperate to collect data for performance measures and share data through ready and IO queues. Main thread will wait until the file reading thread is done and the ready queue and IO queue are empty, then it will print the performance evaluation results and terminate the program... You are asked to design and implement this program in C using pthread (no Java) Also you can use any data structures in different parts of your program and share them along with new variables; but when it comes to maintaining the list of processes in ready queue or IO queue, we would like you to use double linked list, as this is the case in many practical OS. If you still need extra help, click here to download pdf file and watch tk-assign-05-help-29min --------------------------------------------------------------------------------------------------------------------------- Test Case: Please check your program with input2.txt You can then compare your outputs with the ones provided in output2.txt As I mentioned you might be getting slightly different numbers even when you run the same program again! That is fine! --------------------------------------------------------------------------------------------------------------------------- Grading: This is a 60-point homework. First make sure your program works for FIFO CPU scheduling. This will be 25 points. Then you can add/test the others: SJF (10 points), PR (10 points) and RR (10 points). Write a 2-3 page report (5 points) to describe your design choices at the high level and your results. Do all your work under a directory assign5, which should include your source codes, instructions to compile/execute, and some output files showing your test results etc... ---------------------------------------------------------------------------------------------------------------------------
Answered Same DayAug 02, 2022

Answer To: CS 3733 Operating Systems: Assignment 5 - new Write all your programs under assign5. You need to...

Aditi answered on Aug 03 2022
84 Votes
REPORT
In computing, "CPU scheduling" is a technique that allows one application to utilise the CPU while another is waiting for resources like I/O or other comparable resources, allowing the CPU to be used to its max
imum potential. The goal of CPU scheduling is to maximise efficiency, speed, and fairness throughout the system.
Process scheduling is a task performed by the process management, and it entails removing the presently running process from the CPU and replacing it with a new one that follows a predetermined strategy. In multiprogramming operating systems, scheduling processes are essential.
When it comes to CPU Scheduling techniques, there is a wide range of options to choose from. There are a number of criteria that must be completed before CPU scheduling strategies may be compared.
The following is a list of some of the rules:
Keep the CPU busy is the basic purpose of any CPU algorithm. When a real-time system is under heavy strain, CPU utilisation may reach as high as 90% of its total capacity.
Throughput measures how many operations can be started and completed in a particular period of time. The term "throughput" refers to the speed at which a process moves. Depending on how many or how long the processes take, the results might vary.
The turnaround time is the most important consideration for every surgery. It is the time it takes for a process to be completed before it can be called finished that is measured in conversion time. Conversion time is the time spent waiting for memory, queueing, using the CPU, and waiting for I/O to occur.
Even if you start using the Scheduling method, it has no impact on how long it takes to complete the task. When a process is in the ready queue and waits for a response, it simply affects the length of time it spends in the queue
It's not the best idea to choose turnaround time while working in a collaborative environment. While the process continues to calculate new results, an early result may be presented to the user. So the time it takes to get a response from the company after you apply may also be counted as a method in this context. Using the phrase response time, this statistic...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here