example multiprocessor oses
play

Example Multiprocessor OSes Almost all new OSes! Unix Designed - PDF document

Operating Systems Parallel Systems (Now basic OS knowledge) Parallelism Multiple processes concurrently Parallelism CPU1 CPU1 CPU1 Pseudo- Process 1 CPU1 CPU1 CPU1 Process 2 Parallelism CPU1 Process 1 True CPU2 Process 2 1


  1. Operating Systems Parallel Systems (Now basic OS knowledge) Parallelism • Multiple processes concurrently Parallelism CPU1 CPU1 CPU1 Pseudo- Process 1 CPU1 CPU1 CPU1 Process 2 Parallelism CPU1 Process 1 True CPU2 Process 2 1

  2. Parallel Hardware Registers Registers CPU1 CPU2 Disk Memory Controller Disk • Symmetric Multi-Processors • Increasingly common. • How to modify OS to handle new hardware? Two Operating Systems • Divide memory in two • Run an independent OS in each • Each has it’s own processes • Drawbacks – Twice as much memory used for OS – IPC tough – Who controls memory and disk? (convenient) – Inefficient scheduling (efficient) 2

  3. Sharing the Operating System Main Memory Processor 1 Processor 2 OS Code Program Program Counter OS Common Data Counter P1’s OS Data Stack Pointer Stack Pointer P2’s OS Data P1’s OS Stack P2’s OS Stack Race Shared? Conditions! stack process table current process device queues SOS: Multi-Processor Support • In StartUsingProcessTable() – What is the exchangeword mechanism similar too? – We busy wait. Is this ok? Why or why not? • In FinishUsingProcessTable() – We don’t protect setting the Flag. Is this ok? Why or why not? • In SelectProcessTable() – Why do we have the variable return_value ? • What other parts of the OS would need protection? 3

  4. Example Multiprocessor OSes • Almost all new OSes! • Unix • Designed from start – AT&T System V – Sun Solaris – Windows NT/2000 – HP Unix – Mach – OSF Unix – IBM AIX – SGI Irix – Linux Threads Software Multi-Processors 4

  5. Threads (Lightweight Processes) • Basic unit of CPU utilization Process – (“What?!” you say) • Own Program A B C Counter – program counter – register set (Threads) text segment – stack space A stack • Shares B stack C stack – code section – data section A B C – OS resources data segment “Multithreaded Program” Stack A(int tmp) { B(); printf(tmp) A: tmp = 2 ; } C B() { B C(); } A: tmp = 1 C() { A(2); } 5

  6. Example: A Threaded Spreadsheet Recalculate Display Thread Thread Spreadsheet Data Other Data Command Thread What Kinds of Programs to Thread? • Independent tasks – ex: debugger needs GUI, program, perf monitor… – especially when blocking for I/O! • Single program, concurrent operation – Servers + ex: file server, Web server – OS kernels + concurrent system requests by multiple users 6

  7. Thread Benefits • “What about just using multiple processes with shared memory?” – fine – debugging tougher (more thread tools) – processes slower + 30 times slower to create on Solaris + slower to destroy + slower to context switch among – processes eat up memory + few thousand processes not ok + few thousand threads ok Threads Standards • POSIX (Pthreads) – Common API – Almost all Unix’s have thread library • Win32 and OS/2 – very different from POSIX, tough to port – commercial POSIX libraries for Win32 – OS/2 has POSIX option • Solaris – started before POSIX standard – likely to be same as POSIX 7

  8. SOS: Thread Implementation • Why doesn’t the Process have a state anymore? – Does a process have to have threads? • What new system calls might be useful for support of threads? • What new sheduling criteria might the Dispatcher use when scheduling threads? Levels of Threads User Level Thread Process A Process B Thread Kernel Thread 8

  9. Do they Work? • Operating systems – Mach, Windows NT, Windows 95, Solaris, IRIX, AIX, OS/2, OSF/1 – Millions of (unforgiving) users • NFS, SPEC Speedup 1 4 8 12 16 20 24 CPUs 9

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend