review what is an operating system
play

Review : What is An Operating System? ! Software ( kernel ) that - PDF document

Review : What is An Operating System? ! Software ( kernel ) that runs at all times Really, the part of the system that runs in kernel CSCI 6730 / 4730 mode (or need to). Operating Systems But note - there are even


  1. Review : What is An Operating System? ! Software ( ‘ kernel ’ ) that runs at all times » Really, the part of the system that runs in ‘ kernel CSCI 6730 / 4730 mode ’ (or need to). Operating Systems » But note - there are even exceptions to this ‘ rule ’ ! Distinguishing what makes up the OS is challenging (some grey areas) Structures & System Design ! OS performs two unrelated functions: » (1) Provide abstractions of resources to the users or applications programs (extends the machine), and » (2) Manage and coordinate hardware resources (resource manager) – CPU, memory, disk, printer 2 Maria Hybinette, UGA Maria Hybinette, UGA The OS provides an Extended Machine Key Questions in System Design How to provide a beautiful interface, consider: ! What does the OS look like? to the user? ! What services does an operating system provide? • Memory Management • Process Management • File Management • I/O System Management … user � user � user � 1 � 2 � � 3 • Protection & Security … compiler assembler text editor System and Application ! Operating System turn the ugly ugly hardware into Programs Operating System bea eautiful abstractions. Computer Hardware 3 4 Maria Hybinette, UGA Maria Hybinette, UGA Review: Operating System Two Operating System Design Criteria Roles ! How do you hide the complexity and ! Operating System limitations of hardware from application » A machine that (1) emulates the … � programmers? user � user � user � hardware and (2) provides a nice 1 � 2 � � n programming environment for » What is the hardware interface? (the physical [multiple] … reality) ‘ activities ’ (processes) in the compiler assembler text editor » ~~~~~~~ Transformations ~~~~~~~~~~~ � system. System and Application Programs – Definition: A process is an activity » What is the application interface? (what are the in the system – a running program, Operating System nicer and more beautiful abstractions) an activity that may need ‘ services ’ (we will cover this Computer concept in detail next week). Hardware In terms of particular hardware (i.e., CPU, Memory, Network) what criteria does your system need to address (solve). 5 6 Maria Hybinette, UGA Maria Hybinette, UGA

  2. Example Design Questions Summary of OS Key Roles ! How to make multiple CPU appear as one CPU but faster? ! Provide standard services or resources: ! How to make limited memory appear as infinite (e.g., a large array may not fit into memory). » Screen, CPU, I/O, disk, mouse ! How to make a mechanical disk appear to be as fast as » Resource abstraction (extended machine) electronic memory? ! Provide for sharing of resources: ! How to make insecure, unreliable network transmissions » coordinate between multiple applications to work appear to be reliable and secure? together in ! How to make many physical machines appear to be a – safe, efficient, and fair ways (protected) single machine? ! Fairness Fairness » Resource coordination & management. ! Timeliness Timeliness ! Secure Secure ! Reliable Reliable ! Ownership Ownership ! Single Single ‘ machininess machininess ’ 7 8 ! Power-efficient Power-efficient Maria Hybinette, UGA Maria Hybinette, UGA Shell: Another Level of Resource provided to users ! Example: Accessing a raw disk involves ! Provide ‘ users ’ with access to the services of the kernel. » specifying the data, the length of data, the disk drive, the track location(s), and the sector location(s) within the » A ‘ shell ’ of-course,– illusion of a thin layer of corresponding track(s). (150 mph) abstraction to the kernel and its services. write( block, len, device, track, sector ); ! CLI – command line interface to kernel ! Problem: But applications don ’ t want to worry about the services (project 1 focus) complexity of a disk (don ’ t care about tracks or sectors) ! GUI - graphical user interface to the kernel lseek( file, file_size, SEEK_SET ); » ! Project 1 [Check DONE write( file, text, len ); Person -%+'&.$% Shell Abstraction System Calls !"#$%)*&++,'#% OS Abstraction !"#$%&'(% Heads generate a 9 10 magnetic field that Hardware Maria Hybinette, UGA polarize the disk Maria Hybinette, UGA What is the functionality of a [CLI] ‘ shell ’ Review and Moving On… ! Provides two things: ! Looked at the OS role in abstracting the ‘ machine ’ (system calls, and shells). » Interactive Use (IU) » And an environment for ‘ scripting ’ (programmable) ! Moving on to management now. » Project 1 : dealt primarily with IU. » To provide effective resource sharing -> we need ‘ protection ’ (do we?) ! Tcsh – great for IU, not so great for scripting ! Ksh – original version – bulk of code is to provide a great environment for scripting provides powerful programming constructs). » [problem?] Proprietary (until recently -2006) 11 12 Maria Hybinette, UGA Maria Hybinette, UGA

  3. Coordination : Resource Sharing Coordination : Resource Sharing ! Example Goal: Protect the OS from other activities and provide protection across activities. ! Other areas of protection: ! Problem: Activities can crash each other (and crash the OS) » Writing to disk (where) – really any form of I/O. unless there is coordination between them. » Writing / Reading Memory ! General Solution: Constrain an activity so it only runs in its » Creating new processes own memory environment (e.g., in its own sandbox), and make sure the activity cannot access other sandboxes. » Sandbox: Address Space (memory space) ! How do we create (and manage) these – It ’ s others memory spaces that the activity can ’ t touch ‘ areas ’ of protection. including the Operating System ’ s address space 13 14 Maria Hybinette, UGA Maria Hybinette, UGA Hardware: Different modes of Protection Implementation: “ Dual Mode” Operations protection (>2 Intel) How does the OS prevent arbitrary programs (run by arbitrary users) ! Hardware provides different mode ‘ bits ’ of protection – from invoking accidental or malicious calls to halt the operating system where at the lowest level – ring 0 – anything goes, or modify memory such as the master boot sector? unrestricted mode (trusted kernel runs here). ! General Idea: The OS is omnipotent and everything – Intel x86 architecture provides multiple levels of protection: else isn ’ t - as simple as that » Utilize Two modes CPU operation (provided by hardware) – Kernel Mode – Anything goes – access everywhere (unrestricted access) to the underlying hardware. ! In this mode can execute any CPU instruction and reference any memory access – User Mode – Activity can only access state within its own address space (for example - web browsers, calculators, compilers, JVM, word from microsoft, power point, etc run in user mode). 15 16 Maria Hybinette, UGA Maria Hybinette, UGA Hardware: Provides Dual-Mode Operation “System Calls” (e.g., Intel’s trap()) ! Mechanism for user activities (user processes) to ! Mode bit (0 or 1) provided by hardware access kernel functions. » Provides ability to distinguish ! Example: UNIX implements system calls ( ‘ request when system is running user Interrupt/fault, system call � code or kernel code calls ’ ) via the trap() instruction (system call, e.g., read » Mode 1 : normal when address () contains the trap instruction, internally). space is ‘ limited ’ user � kernel � ! Mode bit switch a libc is ;'&4.<%=>7()? % ‘ interrupts ’ (trap) or when !" intermediate 9&@*,% 6,+%3,'4,*%012,% library that calling set user mode trap 2 handles the set user mode � 9'7#+,2%:12,% ‘ packaging ’ A% Trap in Linux is INT 0x80 /#,'%012,% 3,'4,*567),'8"#1'%012,% assembly • Question: What is the mechanism from the point of instruction view of a process to access kernel functions (e.g., it ! When the control returns to the user code the CPU is wants to write to disk)? switched back to User Mode. 17 18 Maria Hybinette, UGA Maria Hybinette, UGA

Recommend


More recommend