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

Lecture Operating systems: Lesson 14 - Dr. Syed Mansoor Sarwar. The main topics covered in this lesson include: short-term scheduler, CPU Scheduling, scheduling processes, dispatcher, fistogram of CPUburst times, reasons for invoking scheduler, optimization criteria, FCFS, SJF, and SRTF, . | Operating Systems Lecture 14 Agenda for Today Review of previous lecture Short-term scheduler Dispatcher Reasons for invoking scheduler Optimization criteria FCFS SJF and SRTF 28 April 2022 Copyright Virtual University of Pakistan Review of Lecture 13 Single and multi-threaded processes Thread models User- and kernel-level threads Pthreads library Sample multi-threaded code 28 April 2022 Copyright Virtual University of Pakistan Example 1 include include include Prototype for a function to be passed to our thread void MyThreadFunc void arg int main pthread_t aThread Create a thread and have it run the MyThreadFunction pthread_create amp aThread NULL MyThreadFunc NULL Parent waits for the aThread thread to exit pthread_join aThread NULL printf quot Exiting the main function. n quot return 0 28 April 2022 Copyright Virtual University of Pakistan Example 1 void MyThreadFunc void arg printf quot Hello world . The threaded version. n quot return NULL gcc o hello lpthread D_REENTRANT hello Hello world . The threaded version. Exiting the main function. 28 April 2022 Copyright Virtual University of Pakistan Example 2 include include define NUM_THREADS 5 void PrintHello void threadid printf quot n d Hello World n quot threadid pthread_exit NULL 28 April 2022 Copyright Virtual University of Pakistan Example 2 int main int argc char argv pthread_t threads NUM_THREADS int rc t for t 0 t lt NUM_THREADS t printf quot Creating thread d n quot t rc pthread_create amp threads t NULL PrintHello void t if rc printf quot ERROR return code is d n quot rc exit -1 pthread_exit NULL 28 April 2022 Copyright Virtual University of Pakistan CPU Scheduling Scheduling processes in the ready queue Short-term scheduler Different types of schedulers 28 April 2022 Copyright Virtual University of Pakistan Life of a Process 28 April 2022 Copyright Virtual University of Pakistan Histogram of CPU- burst Times 28 April 2022 Copyright Virtual University of Pakistan CPU Scheduler Short-term .

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.