Operation System Project (Group 17) PDF
Document Details
Uploaded by ExcitingRhodonite3899
null
Tags
Summary
This document presents a project on Operation Systems, focusing on semaphores. It includes explanations of what semaphores are, why they are needed, and different types, and relates the concept to real-world situations. The presentation may be useful to computer science students.
Full Transcript
Operation System Group 17 CHENG Wan Fung 13322260 CHEUNG Hoi 13357782 WAN Ka Chun 13381898 GUAN Zihao 13231208 TSANG Yik Ho 13431570 CHAN Tsz Yi 13434884 SO Tsz Ho Ivan 13229317 Table of Content 01 What is a Semaphore? 03 Integer Semaphore 02 Why need Semaphore? 04 Record Based Semaphore 01 What is...
Operation System Group 17 CHENG Wan Fung 13322260 CHEUNG Hoi 13357782 WAN Ka Chun 13381898 GUAN Zihao 13231208 TSANG Yik Ho 13431570 CHAN Tsz Yi 13434884 SO Tsz Ho Ivan 13229317 Table of Content 01 What is a Semaphore? 03 Integer Semaphore 02 Why need Semaphore? 04 Record Based Semaphore 01 What is a Semaphore? What is a Semaphore? The concept of Semaphore was proposed by computer scientist Edsger W. Dijkstra, widely used in different operating systems. Using two standard operations: V wait() P signal() for synchronization to handle concurrent processes. Mainly to prevent multiple threads from accessing a shared resource simultaneously. 02 Why need Semaphore? Why need Semaphore? Semaphore is used to solve various synchronization problems. It can prevent race conditions, deadlock and starvation problems. In multi-process or multi-threaded programs, concurrent access to shared resources may lead to race conditions. Semaphores provide a mechanism to coordinate and control these accesses, ensuring the correctness and reliability of the program. Traffic Lights in Multi-Process Semaphores work in the same way as a traffic light in multithreaded or multiprocess program. While a traffic light regulates vehicle movement to avoid collisions, a semaphore is responsible for access rights of multiple processes or threads to shared resources that prevent the program from race conditions and getting correct and reliable results. 03 Integer Semaphore Integer Semaphore Flaw: If the inventory is insufficient, the staff will be stuck in the current state (while loop) and will not continue to serve the next customer." Let “s” = dumbbell While loop feature is to determine how many dumbbells are left. If s