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

Lecture Operating systems: Lesson 25 - Dr. Syed Mansoor Sarwar. The main topics covered in this lesson include: dining philosophers problem, high-level synchronization constructs, critical region, monitor, possibility of deadlock, the region statement, monitors with condition variables, . | Operating Systems Lecture 25 Syed Mansoor Sarwar Agenda for Today Review of previous lecture Dining philosophers problem High-level synchronization constructs Critical region Monitor Recap of lecture 28 April 2022 Copyright Virtual University of Pakistan Review of Lecture 24 Counting semaphores Classical synchronization problems Bounded buffer problem Readers and writers problem Dining philosophers problem 28 April 2022 Copyright Virtual University of Pakistan Dining Philosophers Problem Five philosophers who spend their lives just thinking and eating. Only five chopsticks are available to the philosophers 28 April 2022 Copyright Virtual University of Pakistan Dining Philosophers Problem Each philosopher thinks. When he becomes hungry he sits down and picks up the two chopsticks that are closest to him and eats. After a philosopher finishes eating he puts down the chopsticks and starts to think. 28 April 2022 Copyright Virtual University of Pakistan Dining-Philosophers Problem 28 April 2022 Copyright Virtual University of Pakistan Dining-Philosophers Problem Shared data semaphore chopstick 5 Initialized to 1 28 April 2022 Copyright Virtual University of Pakistan Dining-Philosophers Problem Philosopher i do wait chopstick i wait chopstick i 1 5 eat signal chopstick i signal chopstick i 1 5 think 28while April 2022 1 Copyright Virtual University of Pakistan Possibility of Deadlock If all philosophers become hungry at the same time and pick up their left chopstick a deadlock occurs. 28 April 2022 Copyright Virtual University of Pakistan Possible Solutions Allow at most four philosophers to be sitting simultaneously at the table. Allow a philosopher to pick up his her chopsticks only if both chopsticks are available to do this she must pick them up in a critical section 28 April 2022 Copyright Virtual University of Pakistan Possible Solutions Use an asymmetric solution that is an odd philosopher picks up first her left chopstick whereas an even philosopher picks up .

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
Đã 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.