Republic of the Philippines
UNIVERSITY OF SOUTHERN MINDANAO
Kabacan, Cotabato
COLLEGE OF ENGINEERING AND INFORMATION TECHNOLOGY
CS 10 – Software Engineering
1st Semester 2024-2025
Title Traffic Light Scheme
Topic Operating System - Process Management
Name of Student Adrian Garcia
Date Accomplished October 7, 2024
Road Light Condition (ON) Condition (OFF)
1 Red When road 3 is green or When road 1 is green
yellow
1 Green No vehicles on road 3,4 When road 3 is green
1 Yellow Just before road 1 turns red When road 1 is green
1 Pedestrian Green When road 1 is red When road 1 is green or
yellow
1 Pedestrian Red When road1 is green or When road 1 is red
yellow
2 Red When road 4 is green or When road 2 is green
yellow
2 Green No vehicles on road 4, 3 When road 4 is green
2 Yellow Just before road 2 turns red When road 2 is green
3 Red When road is green or When road 3 is green
yellow
3 Green No vehicles in road 1, 4 When road 1 is green
3 Yellow Just before road 3 turns red When road 3 is green
3 Pedestrian Green When road 3 is red When road 3 is green or
yellow
3 Pedestrian Red When road 3 is green or When road 3 is red
yellow
4 Red When road 2 is green or When road 4 is green
yellow
4 Green No vehicles on road 2, 1 When road 2 is green
4 Yellow Just before road 4 turns red When road 4 is green
Logic Explanation:
Road alternate between being green and red, with yellow functioning as a transitional phase.
Pedestrian can only cross when the light for the corresponding road is red.
Each road has to wait for another road to finish its green phase before it can turn itself. For instance, road is green
light is active only when road 3 is red or yellow.
Process State Transitions (Analogous to Traffic Flow)
Let’s now apply the process state transitions to the car and pedestrian scenario:
Ready to Running:
When the traffic light turns green, the car is ready to proceed, meaning it's going from a "waiting" or "ready"
state to an "active" state. For example, road 1 turns green after road 3 finishes.
Running to Waiting:
When the traffic light turns yellow or a pedestrian button is pressed, cars stop, which means the car is waiting
for the next green light. For example, road 1's light turns yellow and prepares to stop while road 3 might be waiting
to turn green.
Waiting to Ready:
When the light turns from red to green, a vehicle or pedestrian that was waiting (stopped at the red light) is now
ready to proceed (green light is active). For instance, when road 1’s light turns red and road 3’s light turns green.
Running to Terminated:
When the green light turns red or the car finishes crossing, the vehicle has completed its "task" of moving
through the intersection. For example, road 1’s light turns red, and the car's journey is over.
This analogy between process states in an operating system and traffic light controls reflects how the "process"
(cars and pedestrians) moves from one state to another (green to red lights, waiting for pedestrian crossing,
etc.), just as processes in a computer system move between states such as running, waiting, or terminated.