1 / 88

Lecture 2

Lecture 2. Cs506. مواعيد المعمل. الاثنين : 2.30 الى 4 السبت : 5.30 الى 7. Computer-System Architecture. Computer-System Architecture. Single-Processor Systems Multiprocessor Systems Clustered Systems. Computer-System Architecture. 1- Single general-purpose processor

louisea
Download Presentation

Lecture 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 2 Cs506

  2. مواعيد المعمل الاثنين : 2.30 الى 4 السبت : 5.30 الى 7

  3. Computer-System Architecture

  4. Computer-System Architecture • Single-Processor Systems • Multiprocessor Systems • Clustered Systems

  5. Computer-System Architecture 1- Single general-purpose processor • On a single-processor system, there is one main CPU capable of executing a general-purpose instruction set, including instructions from user processes. • Most systems have special-purpose processors as well

  6. Computer-System Architecture 2- Multiprocessors systems : growing in use and importance • Also known as parallel systems, tightly-coupled systems • The system have two or more processors in close communication , sharing the computer bus memory and peripheral devices. • Advantages include • Increased throughput • Economy of scale • Increased reliability – graceful degradation or fault tolerance

  7. Computer-System Architecture • Two types • Asymmetric Multiprocessing • Symmetric Multiprocessing 1- Asymmetric Multiprocessing • In which each processor is assigned a specific task. • A master processor controls the system • Master-slave relation ship 2- Symmetric Multiprocessing • All processors are peers • Many processes can run simultaneous … n processes can run if n CPU

  8. Symmetric Multiprocessing Architecture

  9. Computer-System Architecture - Multi-computing core • Multi processor per chip • Multi chips with single core • Which better? And why? • First • Because on-chip communication is faster than between- chips

  10. A Dual-Core Design

  11. Clustered Systems 3- Clustered Systems • Like multiprocessor systems, but multiple systems working together • A clustered system uses multiple CPUs to complete a task. • It is different from parallel system in that clustered system consists of two or more individual systems tied together. • Definition : The clustered computers share storage and are closely linked via LAN networking.

  12. Clustered Systems • Provides a high-availability service which survives failures: A layer of cluster software runs on cluster nodes. Each node can monitor one or more nodes over the LAN. • The monitored machine can fail in some cases. • The monitoring machine can take ownership of its storage. • The monitoring machine can also restart applications that were running on the failed machine- • The failed machine can remain down but the users will see a brief of the service.

  13. Clustered Systems The clustered system can be of the following forms: • Asymmetric clustering:In this form, one machine is in hot standby mode and other machine is running the application. The hot standby machine performs nothing. It only monitors the server. If failure It becomes the active server if the server fails. • Symmetric clusteringIn this mode, two or more machines run the applications. They also monitor each other at the same time. This mode is more efficient because it uses all available machines. It can be used only if multiple applications are available to be executed • high-performance computing (HPC) • Applications must be written to use parallelization

  14. Operating System Structure

  15. Operating System Structure • Multiprogramming • Multiprocessing • Multitasking

  16. Operating System Structure Multiprogramming: • Multiprogramming is a form of parallel processing in which several programs are run at the same time on a uniprocessor. • Since there is only one processor , there can be no true simultaneous execution of different programs. Instead, the operating system executes part of one program, then part of another, and so on. • To the user it appears that all programs are executing at the same time

  17. Memory Layout for Multiprogrammed System

  18. Operating System Structure • Multiprogramming needed for efficiency • Single user cannot keep CPU and I/O devices busy at all times • Multiprogramming organizes jobs (code and data) so CPU always has one to execute • A subset of total jobs in system is kept in memory • One job selected and run via job scheduling • When it has to wait (for I/O for example), OS switches to another job

  19. Operating System Structure • Note : • Multiprogramming means: that several programs in different stages of execution are coordinated to run on a single I-stream engine (CPU). • Multiprocessing, which is the coordination of the simultaneous execution of several programs running on multiple I-stream engines (CPUs).

  20. Operating System Structure • Timesharing (multitasking): is logical extension in which CPU switches jobs so frequently that users can interact with each job while it is running, creating interactivecomputing

  21. Operating System Structure • Timesharing: • Response time should be < 1 second • Each user has at least one program executing in memory process • If several jobs ready to run at the same time  CPU scheduling • If processes don’t fit in memory, swapping moves them in and out to run • Virtual memory allows execution of processes not completely in memory

  22. Multiprograming Running more then one program with in an application to perform a certain task. • Example : In MS WORD, Writing in document and sending Email • Multitasking Running more then one application to perform a certain task. • Example: listening Song, playing game, work in ms word, excel and other applications simultaneously • Multiprocessing Running more then one instruction through a processor. • Example When create a file then computer takes Time and date default.

  23. Operating-System Operations

  24. Computer-System Operation • Each device controller is in charge of a particular device type (disk drive, video displays etc). • I/O devices and the CPU can execute concurrently. • Each device controller has a local buffer. • CPU moves data from/to main memory to/from local buffers • I/O is from the device to local buffer of controller. • Device controller informs CPU that it has finished its operation by causing an interrupt.

  25. Interrupt • Means : cut off • Hardware interrupt, e.g. services requests of I/O devices • Software interrupt, e.g. signals, invalid memory access, division by zero, system calls, etc –(trap) • Procedures: generic handler or interrupt vector (MS-DOS,UNIX)

  26. Operating-System Operations • Interrupts are an important part of a computer architecture. • Each computer design has its own interrupt mechanism, but several functions are common.

  27. Operating-System Operations • Interrupt driven by hardware • Software error or request creates exceptionor trap • Division by zero, request for operating system service • Other process problems include infinite loop, processes modifying each other or the operating system

  28. Common Functions of Interrupts • Incoming interrupts are disabledwhile another interrupt is being processed to prevent a lost interrupt • A trap is a software-generated interrupt caused either by an error or a user request • An operating system is interrupt driven

  29. Operating-System Operations Instruction Cycle with Interrupts • CPU checks for interrupts after each instruction. • If no interrupts, then fetch next instruction of current program. • If an interrupt is pending, then suspend execution of the current program. The processor sends an acknowledgement signal to the device that issued the interrupt so that the device can remove its interrupt signal. • Interrupt architecture saves the address of the interrupted instruction (and values of other registers).

  30. Operating-System Operations Instruction Cycle with Interrupts • Interrupt transfers control to the interrupt service routine (Interrupt Handler), generally through the interrupt vector, which contains the addresses of all the service routines. • Separate segments of code determine what action should be taken for each type of interrupt

  31. Operating-System Operations Interrupt Handler • A program that determines nature of the interrupt and performs whatever actions are needed • Control is transferred to this program • Generally part of the operating system

  32. Operating-System Operations: Interrupt Handling Procedure • Interrupt Handling Save interrupt information OS determine the interrupt type (by polling) Call the corresponding handlers Return to the interrupted job by the restoring important information (e.g., saved return address program counter)

  33. System Calls

  34. System Calls • System calls : • Interface between processes & OS • Definition: is how a program requests a service from an operating system’s kernel . They provide the interface between a process and operating system. • Is an interface between a user-space application and a service is provided in the kernel.

  35. System Calls • How to make system calls? • Assemble-language instructions or subroutine/functions calls in high-level language such as C or Perl? • Generation of in-line instructions or a call to a special run-time routine. • Example: read and copy of a file! • Library Calls vs System Calls

  36. System Calls • Programming interface to the services provided by the OS • Typically written in a high-level language (C or C++)

  37. System Calls • Three most common APIs are Win32 API for Windows, POSIX API for POSIX-based systems (including virtually all versions of UNIX, Linux, and Mac OS X), and Java API for the Java virtual machine (JVM) • Why use APIs rather than system calls?(Note that the system-call names used throughout this text are generic)

  38. API – System Call – OS Relationship

  39. System Call Implementation • The system call interface invokes intended system call in OS kernel and returns status of the system call and any return values • The caller need know nothing about how the system call is implemented • Just needs to obey API and understand what OS will do as a result call • Most details of OS interface hidden from programmer by API • Managed by run-time support library (set of functions built into libraries included with compiler)

  40. Example of Standard API • Consider the ReadFile() function in the • Win32 API—a function for reading from a file • A description of the parameters passed to ReadFile() • HANDLE file—the file to be read • LPVOID buffer—a buffer where the data will be read into and written from • DWORD bytesToRead—the number of bytes to be read into the buffer • LPDWORD bytesRead—the number of bytes read during the last read • LPOVERLAPPED ovl—indicates if overlapped I/O is being used

  41. Standard C Library Example • C program invoking printf() library call, which calls write() system call

  42. How System Call in Unix

  43. System Call Parameter Passing • Three general methods used to pass parameters to the OS • Simplest: pass the parameters in registers • In some cases, may be more parameters than registers • Parameters stored in a block, or table, in memory, and address of block passed as a parameter in a register • This approach taken by Linux and Solaris • Parameters placed, or pushed, onto the stackby the program and popped off the stack by the operating system • Block and stack methods do not limit the number or length of parameters being passed

  44. Parameter Passing via Table

  45. Types of System Calls • Process control • File management • Device management • Information maintenance • Communications • Protection

  46. Examples of Windows and Unix System Calls

  47. MS-DOS execution (a) At system startup (b) running a program

  48. FreeBSD Running Multiple Programs

More Related