Page 436 - Computer_Science_F5
P. 436
Although it tricky to completely avoid
deadlock situations, operating system Activity 7.5: Chapter Seven: Operating Systems
developers can analyse processes and Online interactive CPU Scheduling
resource requests in advance to prevent Simulation
deadlock situations. Imagine assigning
FOR ONLINE READING ONLY
“service tickets” (resource claims) Objective:
to students before entering the line This activity will help you explore
for accessing teachers. This ensures CPU scheduling algorithms in a fun
everyone can get the resources they and interactive way. You will learn
need. However, despite all preventive how First Come First Served (FCFS)
and avoidance efforts, deadlocks can and Shortest Job First (SJF) impact
process turnaround time.
still occur. Thus, if deadlock occurs, you
can sometimes restart some processes Materials:
or forcibly take away resources to break A computer with internet access to
the cycle. It is like the teacher stepping perform the activity.
in to rearrange the line. Note that
deadlock prevention is mainly ideal, but Instructions:
avoidance can be more practical, while Step 1: Head to the Simulation
recovery from deadlock is disruptive Visit https://visualgo.net/, an online
and best avoided. simulator that allows you to visualise
CPU scheduling algorithms with a
Managing shared resources prevents user-friendly interface.
data corruption by ensuring that only
one process can access a file at a time. Step 2: Choose an Algorithm
Conflicts such as those resulting from Click on “Algorithms” and select
having two users editing the same “First Come First Served (FCFS).”
word processing file simultaneously. Step 3: Create Processes
It also facilitates fairness by ensuring Click on “Processes” to define process
that processes take turns using shared names and their burst times (CPU time
resources, preventing one process from needed) in milliseconds. Start with a
hogging them. Finally, because operating simple scenario: create 4-5 processes
systems use a combination of approaches with varying burst times (e.g., P1:
to manage shared resources efficiently, 500ms, P2: 300ms, P3: 800ms).
understanding these concepts will help you
to appreciate the complexity of running Step 4: Run the Simulation
multiple programs on a computer and Click “Run” and observe. The simulator
ensuring smooth operation for everyone. will display the execution order,
427
Student’s Book Form Five
Computer Science Form 5.indd 427 23/07/2024 12:34

