Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 2: Operating System Structures

Similar presentations


Presentation on theme: "Chapter 2: Operating System Structures"— Presentation transcript:

1 Chapter 2: Operating System Structures

2 OS Services: The Big View (1)
User interface - Almost all operating systems have a user interface: Command-Line, Graphics User Interface (GUI), Batch Program execution – load, run, executed, end execution I/O operations - Deal with I/O devices File-system manipulation - Programs need to read and write files and directories, create and delete them, search them, list file Information, permission management. Communications – Processes frequently exchange information through message passing or shared memory

3 OS Services: The Big View (2)
Error detection – OS needs to be constantly aware of possible errors: CPU, memory, I/O devices and be able to take action Resource allocation - When multiple users or multiple jobs running concurrently, resources must be allocated to each of them: CPU, RAM, files, I/O devices Accounting - To keep track of which users use how much and what kinds of computer resources Protection and security – Protection - ensure that all access to system resources is controlled Security – protect system from outside users

4 A View of Operating System Services

5 System Calls Programming interface to the services provided by the OS
Typically written in a high-level language (C or C++) Mostly accessed by programs via a high-level Application Programming Interface (API) rather than direct system call use 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)

6 Example of System Calls
System call sequence to copy the contents of one file to another file

7 Example of Standard API

8 System Call Implementation
The system call interface invokes the 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

9 API – System Call – OS Relationship

10 Types of System Calls Process control
create process, terminate process end, abort load, execute get process attributes, set process attributes wait for time wait event, signal event allocate and free memory Dump memory if error Debugger for determining bugs, single step execution Locks for managing access to shared data between processes

11 Types of System Calls File management Device management
create file, delete file open, close file read, write, reposition get and set file attributes Device management request device, release device get device attributes, set device attributes logically attach or detach devices

12 Types of System Calls (Cont.)
Information maintenance get time or date, set time or date get system data, set system data get and set process, file, or device attributes Communications create, delete communication connection send, receive messages if message passing model to host name or process name From client to server Shared-memory model create and gain access to memory regions transfer status information attach and detach remote devices

13 Types of System Calls (Cont.)
Protection Control access to resources Get and set permissions Allow and deny user access

14 Examples of Windows and Unix System Calls

15 System Call Example include <stdio.h> #include <fcntl.h> #include <sys/stat.h> int main(int argc, char* argv[]) { int inFile, outFile; int len; char ch; if (argc != 3) printf("Usage: copy <f1> <f2>\n"); exit(1); } inFile = open(argv[1], O_RDONLY); outFile = open(argv[2], O_WRONLY | O_CREAT, S_IRWXU); while ((len = read(inFile, &ch, 1)) > 0) write(outFile, &ch, 1); close(inFile); close(outFile); return 0;

16 Single-tasking: MS-DOS
Shell invoked when system booted Simple method to run program No process created Single memory space Loads program into memory, overwriting all but the kernel Program exit -> shell reloaded At system startup running a program

17 Multitasking: unix Multitasking
User login -> invoke user’s choice of shell Shell executes fork() system call to create process Executes exec() to load program into process Shell waits for process to terminate or continues with user commands Process exits with: code = 0 – no error code > 0 – error code

18 Traditional UNIX System Structure

19 System Boot When power initialized, execution starts at a fixed memory location Firmware ROM used to hold initial boot code Operating system must be made available to hardware so hardware can start it Small piece of code – bootstrap loader, stored in ROM or EEPROM locates the kernel, loads it into memory, and starts it Sometimes two-step process where boot block at fixed location loaded by ROM code, which loads bootstrap loader from disk Common bootstrap loader, GRUB, allows selection of kernel from multiple disks, versions, kernel options Kernel loads and system is then running

20 O/S Milestones (1) IBSYS OS/360
Fifties Resident monitor IBM 1401/7094 OS/360 Sixties IBM 360 Multiprogramming Frederick Brooks, The Mythical Man-Month CTSS (Conversational Timesharing System) Early sixties MIT for IBM 7098 Early version of time sharing 11/28/2017

21 O/S Milestones (2) Multics OS/370 Mid sixties MIT, Bell Labs, GE
Many seminal o/s ideas, time-sharing in particular Idea of a computer utility OS/370 Time sharing Virtual memory (but Manchester Atlas was first VM machine) 11/28/2017

22 O/S Milestones (3) Unix Ken Thompson worked on Multics
He and Dennis Ritchie create a stripped- down, one user version of Multics Early seventies DEC PDP-7 Later ported to a PDP-11: led to the idea that an o/s does not have to be hardware specific PDP-11 version written in C (Kernighan and Ritchie) 11/28/2017

23 O/S Milestones (4) MS-DOS Minix Early 80s
Built for IBM to exploit mass-marketed 8086 Preceded by CP/M (Gary Kildall, consultant to Intel) Minix Mid 80s Teaching version of Unix to run on intel processors 11/28/2017

24 O/S Milestones (4) Linux 90’s Fully-featured o/s Linus Thorvalds
Hello everybody out there using minix - I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. This has been brewing since april, and is starting to get ready. I'd like any feedback on things people like/dislike in minix, as my OS resembles it somewhat (same physical layout of the file-system (due to practical reasons) among other things).   I've currently ported bash(1.08) and gcc(1.40), and things seem to work. This implies that I'll get something practical within a few months, and I'd like to know what features most people would want. Any suggestions are welcome, but I won't promise I'll implement them :-)   Linus   PS. Yes – it's free of any minix code, and it has a multi-threaded fs. It is NOT portable (uses 386 task switching etc), and it probably never will support anything other than AT-harddisks, as that's all I have :-(. 11/28/2017

25 O/S Milestones (5) Windowing Systems
Doug Engelbart SRI, Xerox Parcmouse, windows etc. Steve Jobs saw it during a visit Macintosh Microsoft Windows in all of its incarnations 11/28/2017

26 OS Milestones (6) Virtual Machines
Create the illusion of multiple operating systems running on the same physical hardware IBM’s CP/CMS and VM/370 (early seventies) VirtualBox, VMware (current) 11/28/2017

27 OS Milestones (7) Mobile Computing
1990s: Combine personal digital assistant (PDA) and mobile phone Term “smartphone” coined in 1997 Current Dominant OS Linux-based Android from Google iOS from Apple 11/28/2017


Download ppt "Chapter 2: Operating System Structures"

Similar presentations


Ads by Google