OS(4)
OS(4)
https://www.ii.pwr.edu.pl/~juszczyszyn/so.htm
More information:
GeeksforGeeks | A computer science portal for
geeks
https://www.geeksforgeeks.org/comparison-of-different-
cpu-scheduling-algorithms-in-os/
https://www.geeksforgeeks.org/first-come-first-serve-
cpu-scheduling-non-preemptive/
https://www.geeksforgeeks.org/program-for-shortest-job-
first-or-sjf-cpu-scheduling-set-1-non-preemptive/
https://www.geeksforgeeks.org/preemptive-and-non-
preemptive-scheduling/
https://www.geeksforgeeks.org/round-robin-scheduling-
in-operating-system/
NESO ACADEMY on YouTube
https://www.youtube.com/watch?v=EWkQl0n0w5M
https://www.youtube.com/watch?v=pVzb3TUcDLo
https://www.youtube.com/watch?v=4DhFmL-6SDA
https://www.youtube.com/watch?v=bWHFY8-rL5I
https://www.youtube.com/watch?v=7DoP1L9nAAs
https://www.youtube.com/watch?v=VSMAjMfJ6KQ
https://www.youtube.com/watch?v=8-BUGte27sk
https://www.youtube.com/watch?v=t0g9b3SJECg
https://www.youtube.com/watch?v=lpM14aWgl3Q
https://www.youtube.com/watch?v=ypOnf9mnFYg
https://www.youtube.com/watch?v=YzBBJYfwdi8
https://www.youtube.com/watch?v=7TpxxTNrcTg
https://www.youtube.com/watch?v=QlCmgBOMjlI
https://www.youtube.com/watch?v=wioTortHb_g
Description of algorithms for 2. program (disk
scheduling algorithms)
The program should simulate the operation of disk access
planning algorithms.
- In our case, 'disk' is a linearly ordered sequence of blocks
with numbers from 1 to MAX.
- The criterion for evaluating the algorithms will be the
total seek time/head movements, which, as is known,
is proportional to the time of order execution.
The program should simulate the operation of the following
algorithms:
- FCFS (First Come First Serve),
- SSTF (Shortest Seek Time First),
- SCAN (Elevator Algorithm),
- C-SCAN (Circular Elevator Algorithm).
The program should also predict the situations of real-time
applications (this can be for any algorithm, e.g. for only one,
SSTF or FCFS), which must be handled using EDF and/or FD-
SCAN. Should the results be provided?
Short explanation of real-time algorithms
EDF – Earliest Deadline First – is an "equivalent of SJF",
handles requests in order from the shortest to the
longest deadline (priority: deadline – time to completion)
FD-SCAN – Feasible-Deadline Scan – a head moves
towards the nearest (on the disk – priority:
proximity/distance on the disk) POSSIBLE DEADLINE but
executes all requests that were in the space between the
current position and the position of the request it is heading
to.
However, if it is calculated that moving the head to the
desired location will take longer than the deadline indicates,
then such action will not be taken. Abandoned requests
should also be counted.
Difference between algorithms: EDF vs. SSTF execution
deadlines are considered instead of distances. For each
algorithm, including real-time (EDF, FD-SCAN) the program
should return a total seek time/head movements.
After executing real-time requests, the remaining requests are
executed according to the previous algorithm, e.g. SSTF, FIFO,
etc.
Only one real-time algorithm can be present in the program:
EDF or FD-SCAN.
The program should show the total seek time/head
movements. We are looking for an algorithm where this sum of
distances will be as small as possible.
NOTE!
The formulation of simulation conditions not mentioned above is
your responsibility. I mean:
- size of the 'disk' (number of blocks),
- number and method of generating requests (full queue from
the beginning? requests in progress? distribution of requests –
even, other?),
- method of considering real-time handling of requests
- other... >>> the ability to justify the adopted solution is
welcome.
More information:
GeeksforGeeks | A computer science portal for
geeks
https://www.geeksforgeeks.org/disk-scheduling-algorithms/
https://www.geeksforgeeks.org/fcfs-disk-scheduling-
algorithms/
https://www.geeksforgeeks.org/sstf-full-form/
https://www.geeksforgeeks.org/program-for-sstf-disk-
scheduling-algorithm/
https://www.geeksforgeeks.org/scan-elevator-disk-
scheduling-algorithms/
https://www.geeksforgeeks.org/c-scan-disk-scheduling-
algorithm/
https://www.geeksforgeeks.org/earliest-deadline-first-
edf-cpu-scheduling-algorithm/
https://www.geeksforgeeks.org/look-disk-scheduling-
algorithm/
NESO ACADEMY on YouTube
https://www.youtube.com/watch?v=MSB2GZ0xydc
https://www.youtube.com/watch?v=MiDFgPYrjBk
Description of algorithms for 3. program (page
replacement algorithms)
In most systems, the size of a process's virtual address space is
much larger than the available main memory (RAM).
You should write a program that will contain simulations of 5
page replacement algorithms.
You should formulate your own simulation assumptions:
- size of virtual memory (number of pages),
- size of physical memory (number of frames),
- length (should be significant – min. 1000) and method of
generating a sequence of page references (it is
necessary to consider the principle of locality of
references).
Program operation:
- generate a random sequence of n page references,
- for the generated sequence, show the number of page
faults for various page replacement algorithms:
1) FCFS (FIFO),
2) FCFS (FIFO) with second chance (ALRU),
3) LRU,
4) OPT,
5) RAND.
Simulations should be performed (on the same test string) for a
different number of frames (e.g., several (5, 10, 20?) values
provided by the user).
More information:
GeeksforGeeks | A computer science portal for
geeks
https://www.geeksforgeeks.org/virtual-memory-in-
operating-system/
https://www.geeksforgeeks.org/page-fault-handling-in-
operating-system/
https://www.geeksforgeeks.org/page-replacement-
algorithms-in-operating-systems/
https://www.geeksforgeeks.org/program-page-
replacement-algorithms-set-2-fifo/
https://www.geeksforgeeks.org/page-faults-in-lru-
implementation/
https://www.geeksforgeeks.org/program-for-least-
recently-used-lru-page-replacement-algorithm/
https://www.geeksforgeeks.org/videos/random-page-
replacement-algorithm-in-os/
Wikipedia.com
https://en.wikipedia.org/wiki/Page_replacement_algorithm
YouTube
https://www.youtube.com/watch?v=puobwv1xjqc
https://www.youtube.com/watch?v=A9WLYbE0p-I&t=450s
https://www.youtube.com/watch?v=fGP6VHxqkIM
https://www.youtube.com/watch?v=p9yZNLeOj4s
https://www.youtube.com/watch?v=qlH4-oHnBb8
https://www.youtube.com/watch?v=59rEMnKWoS4
Description of algorithms for 4. program (frame
allocation algorithms)
This is an extension of program no. 4. You should assume that:
- a certain number of processes (~10) are running in the
system,
- each process uses its own set of pages (the locality
principle still applies),
- the global reference sequence is the result of combining
the reference sequences generated by individual
processes (each generates many, not just one),
- the system allocates a certain number of frames to each
based on the following methods:
1. Equal allocation,
2. Proportional allocation (frames are allocated based on
the size of the processes and not on the number of
references!!!!),
3. Page fault frequency (Page fault rate control),
4. Zone model (working set).
- pages are replaced according to LRU.
How do frame allocation strategies affect the results (number of
page faults – globally, for each process)?
The program should print the adopted simulation assumptions
on the screen. The ability to change them by the user is
welcome.
Conclusions?
More information:
1. https://www.geeksforgeeks.org/operating-system-
allocation-frames/
2. https://www.geeksforgeeks.org/difference-between-
multitasking-multithreading-and-multiprocessing/
3. https://www.youtube.com/watch?v=SgC-l_tgmIM
4. https://www.youtube.com/watch?v=m-6jT6CH-0M
Description of algorithms for 5 program (balances
the load on processors)
You should write a program that will contain simulations of the
distributed algorithm that balances the load on processors.
More information:
https://www.geeksforgeeks.org/multiple-processor-
scheduling-in-operating-system/?ref=lbp