Lecture Operating systems: Lesson 24 - Dr. Syed Mansoor Sarwar

Lecture Operating systems: Lesson 24 - Dr. Syed Mansoor Sarwar. The main topics covered in this lesson include: types of semaphores, counting semaphores, classical synchronization problems, bounded buffer problem, readers and writers problem, dining philosophers problem, . | Operating Systems Lecture 24 Syed Mansoor Sarwar Agenda for Today Review of previous lecture Counting semaphores Classical synchronization problems Bounded buffer problem Readers and writers problem Dining philosophers problem Recap of lecture 28 April 2022 Copyright Virtual University of Pakistan Review of Lecture 23 Busy waiting New definition of semaphore Process synchronization Deadlock and starvation Binary and counting semaphores 28 April 2022 Copyright Virtual University of Pakistan Types of Semaphores Counting semaphore integer value can range over an unrestricted integer domain. Binary semaphore integer value cannot be gt 1 can be simpler to implement. 28 April 2022 Copyright Virtual University of Pakistan Implementing a Counting Semaphore Data structures binary-semaphore S1 S2 int C Initialization S1 1 S2 0 C initial value of semaphore S 28 April 2022 Copyright Virtual University of Pakistan Implementing a Counting Semaphore wait S wait S1 C- if C lt 0 signal S1 wait S2 28 April 2022 signal S1 Copyright Virtual University of Pakistan Implementing a Counting Semaphore signal S wait S1 C if C Classical Problems of Synchronization Bounded-Buffer Problem Readers and Writers Problem Dining Philosophers Problem 28 April 2022 Copyright Virtual University of Pakistan Bounded Buffer Problem Empty Pool Producer Consumer Full Pool 28 April 2022 Copyright Virtual University of Pakistan Bounded-Buffer Problem Shared data semaphore full empty mutex Initialization full 0 empty n mutex 1 28 April 2022 Copyright Virtual University of Pakistan Producer Process do produce an item in nextp wait empty wait mutex add nextp to buffer signal mutex signal full while 1 CopyrightPakistan 28 April 2022 Virtual University of Consumer Process do wait full wait mutex remove an item from buffer to nextc signal mutex signal empty consume the item in nextc while 28 April 2022 1 CopyrightPakistan Virtual University of Readers and Writers Problem 28 April 2022 Copyright Virtual University

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
5    58    1    19-04-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.