OS PROJECT CODES
Ten students (s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) are going to attend an event. There are lots
of gift shops, they all are going to the gift shops and randomly picking the gifts. After
picking the gifts they are randomly arriving in the billing counter. The accountant gives
the preference to that student who has maximum number of gifts. Create a C program to
define order of billed students?
2. Consider a scenario of demand paged memory. Page table is held in registers. It takes 8
milliseconds to service a page fault if an empty page is available or the replaced page is
not modified and 20 milliseconds if the replaced page is modified. Memory access time is
100 nanoseconds. Assume that the page to be replaced is modified 70 percent of the time.
Generate a solution to find maximum acceptable page-fault rate for access time that is not
more than 200 nanoseconds.
3. Consider a scheduler which schedules the job by considering the arrival time of the processes where arrival time if given as 0 is discarded or displayed as error. The scheduler implements the shortest job first scheduling policy, but checks the queue of the processes after the every process terminates and time taken for checking and arranging the process according to the shortest job is 2 time unit. Compute the waiting time, turnaround time and average waiting time and turnaround time of the processes. Also compute the total time taken by the processor to compute all the jobs.
4.CPU schedules N processes which arrive at different time intervals and each process is
allocated the CPU for a specific user input time unit, processes are scheduled using a
preemptive round robin scheduling algorithm. Each process must be assigned a numerical
priority, with a higher number indicating a higher relative priority. In addition to the
processes one task has priority 0. The length of a time quantum is T units, where T is the
custom time considered as time quantum for processing. If a process is preempted by a
higher priority process, the preempted process is placed at the end of the queue. Design a
scheduler so that the task with priority 0 does not starve for resources and gets the CPU at
some time unit to execute. Also compute waiting time, turn around.
6. (Question 17):
. Design a scheduling program to implements a Queue with two levels:
Level 1 : Fixed priority preemptive Scheduling
Level 2: Round Robin SchedulingFor a Fixed priority preemptive Scheduling (Queue1), the Priority 0 is highest priority. If one
process P1 is scheduled and running, another process P2 with higher priority comes. The New
process (high priority) process P2 preempts currently running process P1 and process P1 will go
to second level queue. Time for which process will strictly execute must be considered in the
multiples of 2. All the processes in second level queue will complete their execution according to
round robin scheduling.
Consider: 1. Queue 2 will be processed after Queue 1 becomes empty.
2. Priority of Queue 2 has lower priority than in Queue 1.
7. IndianRail has decided to improve its efficiency by automating not just its trains but also its passengers. Each passenger and each train is controlled by a thread. You have been hired to write synchronization functions that will guarantee orderly loading of trains. You must define a structure struct station, plus several functions described below. When a train arrives in the station and has opened its doors, it invokes the function station_load_train(struct station *station, int count)
8.Sudesh Sharma is a Linux expert who wants to have an online system where he can
handle student queries. Since there can be multiple requests at any time he wishes to dedicate a
fixed amount of time to every request so that everyone gets a fair share of his time. He will log
into the system from 10am to 12am only. He wants to have separate requests queues for students
and faculty. Implement a strategy for the same. The summary at the end of the session should
include the total time he spent on handling queries and average query time.
9..Write a program in C which reads input CPU bursts from a the first line of a text file named as CPU_BURST.txt. Validate the input numbers whether the numbers are positive intergers or not. Consider the numbers as CPU burst.If there are 5 positive integers in the first line of the text file then the program treat those argument as required CPU bust for P1, P2, P3, P4, and P5 process and calculate average waiting time and average turn around time. Consider used scheduling algorithm as SJF and same arrival time for all the processes.
The following processes are being scheduled using a preemptive, round-robin scheduling algorithm. Each
process is assigned a numerical priority, with a higher number indicating a higher relative priority. In addition
to the processes listed below, the system also has an idle task (which consumes no CPU resources and is
identified as P idle ). This task has priority 0 and is scheduled whenever the system has no other availableprocesses to run. The length of a time quantum is 10 units. If a process
a. Show the scheduling order of the processes using a Gantt chart.
b. What is the turnaround time for each process?
c. What is the waiting time for each process?
d. What is the CPU utilization rate?
12. Design a scheduling program to implements a Queue with two levels: Level 1 : Fixed priority preemptive Scheduling Level 2: Round Robin Scheduling For a Fixed priority preemptive Scheduling (Queue1), the Priority 0 is highest priority. If one process P1 is scheduled and running, another process P2 with higher priority comes. The New process (high priority) process P2 preempts currently running process P1 and process P1 will go to second level queue. Time for which process will strictly execute must be considered in the multiples of 2. All the processes in second level queue will complete their execution according to round robin scheduling. Consider: 1. Queue 2 will be processed after Queue 1 becomes empty. 2. Priority of Queue 2 has lower priority than in Queue 1.
13.Write a C program to solve the following problem: Suppose that a disk drive has 5,000
cylinders, numbered 0 to 4999. The drive is currently serving a request at cylinder143,
and the previous request was at cylinder 125. The queue of pending requests, in FIFO
86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130
Starting from the current head position, what is the total distance (in cylinders)that the disk arm
moves to satisfy all the pending requests for each of the FCFS disk-scheduling algorithms?
14. Design a scheduler with multilevel queue having two queues which will schedule the processes on the basis of pre-emptive shortest remaining processing time first algorithm (SROT) followed by a scheduling in which each process will get 2 units of time to execute. Also note that queue 1 has higher priority than queue 2. Consider the following set of processes (for reference)with their arrival times and the CPU burst times in milliseconds.