1. Trang chủ
  2. » Công Nghệ Thông Tin

Advanced Operating Systems: Lecture 22 - Mr. Farhan Zaidi

38 2 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Advanced Operating Systems - Lecture 22: Mark and sweep collecting. This lecture will cover the following: mark using depth-first traversal of the memory graph; sweep using lengths to find next block; main frame operating systems; time-sharing systems; multiprocessor operating systems; PC operating systems;...

CS703 ­ Advanced  Operating Systems By Mr Farhan Zaidi Lecture No.  22 Mark and Sweep Collecting Mark bit set root Before mark After mark After sweep free free Mark and Sweep Mark using depth-first traversal of the memory graph ptr mark(ptr p) { if (!is_ptr(p)) return; if (markBitSet(p)) return setMarkBit(p); for (i=0; i < length(p); i++) mark(p[i]); return; } // // // // Sweep using lengths to find next block ptr sweep(ptr p, ptr end) { while (p < end) { if markBitSet(p) clearMarkBit(); else if (allocateBitSet(p)) free(p); p += length(p); } } nothing if not pointer check if already marked set the mark bit mark all children What is an operating system? Top-down view Bottom-up view   Time multiplexing Space multiplexing Type of Operating Systems       Main frame operating systems Time-sharing systems Multiprocessor operating systems PC operating systems Real-time operating systems Embedded operating systems OS Structure    Monolithic Design Layering Micro-kernel ELF Object File Format      Elf header Program header table text section data section bss section Strong and Weak Symbols  Program symbols are either strong or weak Linker’s Symbol Rules  Rule A strong symbol can only appear once  Rule A weak symbol can be overridden by a strong symbol of the same name  Rule If there are multiple weak symbols, the linker can pick an arbitrary one Safe and Unsafe Trajectories Thread T2 Safe trajectory S2 critical section wrt cnt Unsafe trajectory Unsafe region U2 L2 H2 H1 L1 U1 S1 critical section wrt cnt T1 Thread Semaphores  semaphore = a synchronization primitive – higher level than locks – invented by Dijkstra in 1968, as part of the THE OS Two uses of semaphores   Mutual exclusion Scheduling constraints Condition variables  Condition variable: a queue of threads waiting for something inside a critical section  Wait() release lock, go to sleep, re-acquire lock  Signal() wake up a waiter, if any  Broadcast() wake up all waiters Reentrant Functions Thread-safe functions Reentrant functions Thread-unsafe functions Formal definition of a deadlock  A set of processes is deadlocked if each process in the set is waiting for an event that only another process in the set can cause Conditions for deadlock Without all of these, can't have deadlock: Mutual exclusion No preemption Hold and wait Circular wait Paradigms of thread usage  (from Hauser et al paper)      Defer work General pumps Slack processes Sleepers One-shots      Deadlock avoidance Rejuvenation Serializers Encapsulated fork Exploiting parallelism Scheduling: First come first served (FCFS or FIFO)  Simplest scheduling algorithm:  Run jobs in order that they arrive Round robin (RR)  Solution to job monopolizing CPU? Interrupt it  Run job for some “time slice,” when time is up, or it blocks, it moves to back of a FIFO queue Priority scheduling  Obvious: not all jobs are equal  So: rank them A simple multi­level feedback queue priority Summary  FIFO:    RR:    + better for short jobs - poor when jobs are the same length STCF:     + simple - short jobs can get stuck behind long ones; poor I/O + optimal (ave response time, ave time-to-completion) - hard to predict the future - unfair Multi-level feedback:   + approximate STCF - unfair to long running jobs Multiprocessor Thread Scheduling   Dedicated processor assignment Dynamic scheduling Gang Scheduling  Simultaneous scheduling of threads that make up a single process ... children What is an? ?operating? ?system? Top-down view Bottom-up view   Time multiplexing Space multiplexing Type of? ?Operating? ?Systems       Main frame operating systems Time-sharing systems... systems Multiprocessor operating systems PC operating systems Real-time operating systems Embedded operating systems OS Structure    Monolithic Design Layering Micro-kernel ELF Object File Format... short jobs - poor when jobs are the same length STCF:     + simple - short jobs can get stuck behind long ones; poor I/O + optimal (ave response time, ave time-to-completion) - hard to predict

Ngày đăng: 05/07/2022, 12:29

Xem thêm:

Mục lục

    CS703 - Advanced Operating Systems

    Mark and Sweep Collecting

    What is an operating system?

    Type of Operating Systems

    ELF Object File Format

    Strong and Weak Symbols

    Linker’s Symbol Rules

    fork: Creating new processes

    exec: Running new programs

    Safe and Unsafe Trajectories

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN