Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Operating Systems CS-2301 B-term 20081 Introduction to Operating Systems CS-2301, System Programming for Non-majors (Slides include materials.

Similar presentations


Presentation on theme: "Introduction to Operating Systems CS-2301 B-term 20081 Introduction to Operating Systems CS-2301, System Programming for Non-majors (Slides include materials."— Presentation transcript:

1 Introduction to Operating Systems CS-2301 B-term 20081 Introduction to Operating Systems CS-2301, System Programming for Non-majors (Slides include materials from The C Programming Language, 2 nd ed., by Kernighan and Ritchie and from C: How to Program, 5 th ed., by Deitel and Deitel)

2 Introduction to Operating Systems CS-2301 B-term 20082 Why an Intro to Operating Systems? This is a System Programming Course For people who are not CS majors (Nearly) every programming task in real- life includes working with an OS Inevitably will have to deal with principle OS features Even if not knowledgeable in their designs

3 Introduction to Operating Systems CS-2301 B-term 20083 Class Discussion What is an Operating System? (Laptops closed, please!)

4 Introduction to Operating Systems CS-2301 B-term 20084 What Operating Systems have you Used? (Other than Windows, Linux, Mac-OS, Unix)

5 Introduction to Operating Systems CS-2301 B-term 20085 What is an Operating System? Characteristics –Large, complex set of programs –Long-lived, evolving –Worked on by many people for many years Functions –Creates abstractions –Multiplexes concurrent activities –Manages resources –Mediates access to hardware devices –Provides a variety of services to users and applications –…–…

6 Introduction to Operating Systems CS-2301 B-term 20086 What is an Operating System? Characteristics –Large, complex set of programs –Long-lived, evolving –Worked on by many people for many years Functions –Creates abstractions –Multiplexes concurrent activities –Manages resources –Mediates access to hardware devices –Provides a variety of services to users and applications –… Large = 10 8 –10 9 lines of code (Windows and Linux) 10 7 line of code for a real-time OS.

7 Introduction to Operating Systems CS-2301 B-term 20087 Definition – Abstraction The distillation of a complex mechanism into a simple, conceptual model User of abstraction does not need to worry about details Implementer of abstraction does not need to worry about how user will use it (within limits)

8 Introduction to Operating Systems CS-2301 B-term 20088 Operating Systems Typically –Long-lived –Frequently extended and updated –Worked on by many developers –Used and, maybe, abused by a variety of users with varying expertise and expectations Essential to create an acceptable computing environment to create and execute other programs that achieve business or personal goals

9 Introduction to Operating Systems CS-2301 B-term 20089 Kinds of operating systems Mainframe Operating Systems Server Operating Systems Multiprocessor Operating Systems Personal Computer Operating Systems Handheld Computer Operating Systems Embedded Operating Systems Sensor Node Operating Systems Real-time Operating Systems Smart-card Operating Systems …

10 Introduction to Operating Systems CS-2301 B-term 200810 OS and Hardware OS mediates programs’ access to hardware –Computation – CPU –Storage – volatile (memory) and persistent (disk) –Networks – NIC, protocols –I/O devices – sound cards, keyboards, displays

11 Introduction to Operating Systems CS-2301 B-term 200811 Four fundamental Abstractions Processes & threads Multiplexing of processor(s) to create the illusion of many of them Virtual memory Multiplexing of physical memory and disk blocks to create illusion of own memory per process Files & persistent storage Organizing principles about long-term data storage Sockets & connections Organizing principles about network communication

12 Introduction to Operating Systems CS-2301 B-term 200812 Definition – Process A particular execution of a program Different from all other executions of that program Different from executions of other programs The OS uses one or more CPUs to make it look like each process has own CPU Can execute at same time! Uses interrupts to manage and enforce multiplexing of CPU

13 Introduction to Operating Systems CS-2301 B-term 200813 Why Processes? Enables programmers –to completely disengage from issues of concurrent execution of independent programs –to build applications with more than one concurrent activity Enables independent applications to share a computing system

14 Introduction to Operating Systems CS-2301 B-term 200814 Why Processes (continued)? Exploit modern processors –Capable of executing multiple threads of execution simultaneously –Interleaved at instruction level or even memory access level Moore’s Law:– –Integrated circuit components shrink in size by 50% every 18 months –Double in speed every 18 months

15 Introduction to Operating Systems CS-2301 B-term 200815 Why Processes (continued)? Exploit modern processors –Capable of executing multiple threads of execution simultaneously –Interleaved at instruction level or even memory access level Moore’s Law:– –Integrated circuit components shrink in size by 50% every 18 months –Double in speed every 18 months Modern limitation due to power dissipation.

16 Introduction to Operating Systems CS-2301 B-term 200816 Resources Assigned to a Process Memory Virtual or real Processor time Priorities Deadlines for real-time activities Privileges Security, authentication, etc. Files and file space For long-term storage, temporary storage Devices For input and output activity, sensors, etc.

17 Introduction to Operating Systems CS-2301 B-term 200817 Resources (continued) Managed by OS Protection and isolation from other processes Allocation according to defined policies Enforcement of limits, etc. …

18 Introduction to Operating Systems CS-2301 B-term 200818 Threads A refinement of concept of process Short for “thread of control” An concurrent execution of a function within the context of a process Including all functions it calls Needs own stack Shares heap with other threads of same process

19 Introduction to Operating Systems CS-2301 B-term 200819 Threads (continued) Linux:– A thread is a special kind of process that shares all resources with other threads A Process group is the collection of threads making up a process Windows:– Threads are fundamental objects Process is a group of threads plus memory plus other resources

20 Introduction to Operating Systems CS-2301 B-term 200820 Why Threads? To enable development of applications with concurrent activities inside them Need to share data (difficult with separate processes) Examples Web server over common data pages Transaction processor over common data base Applications within a mobile phone or PDA Applications with different speeds of devices …

21 Introduction to Operating Systems CS-2301 B-term 200821 Virtual Memory Definition:– the illusion that a process has its own, isolated memory (Often) more memory than machine has installed May be implemented using interrupts, pages, and disk blocks Swapping fast enough so process is unaware May be implemented by partitioning Swapping not necessary for real-time activities

22 Introduction to Operating Systems CS-2301 B-term 200822 Typical Virtual Memory for Process (Windows & Linux) 0x00000000 0xFFFFFFFF address space program code (text) static data heap (dynamically allocated) stack (dynamically allocated) PC SP

23 Introduction to Operating Systems CS-2301 B-term 200823 Typical Virtual Memory for Process (Windows & Linux) 0x00000000 0xFFFFFFFF address space program code (text) static data heap (dynamically allocated) stack (dynamically allocated) PC SP Every process has one of these. Separate from every other process.

24 Introduction to Operating Systems CS-2301 B-term 200824 Virtual Memories in Embedded System OS Kernel stack Process 1 stack Process 2 0x00000000 0x0000FFFF Physical memory stack Process 3

25 Introduction to Operating Systems CS-2301 B-term 200825 Virtual Memory for Multiple Threads 0x00000000 0xFFFFFFFF Virtual address space code (text) static data heap thread 1 stack PC (T2) SP (T2) thread 2 stack thread 3 stack SP (T1) SP (T3) PC (T1) PC (T3)

26 Introduction to Operating Systems CS-2301 B-term 200826 Note on Threads Most embedded system programmers will probably have to design with multiple threads in the future

27 Introduction to Operating Systems CS-2301 B-term 200827 Questions?


Download ppt "Introduction to Operating Systems CS-2301 B-term 20081 Introduction to Operating Systems CS-2301, System Programming for Non-majors (Slides include materials."

Similar presentations


Ads by Google