CENG 334 Operating Systems 01 Introduction Assoc Prof

  • Slides: 28
Download presentation
CENG 334 – Operating Systems 01 - Introduction Assoc. Prof. Yusuf Sahillioğlu Computer Eng.

CENG 334 – Operating Systems 01 - Introduction Assoc. Prof. Yusuf Sahillioğlu Computer Eng. Dept, , Turkey

Administrative 2 / 28 ü Fri 13: 40 -17: 30 ü www. ceng. metu.

Administrative 2 / 28 ü Fri 13: 40 -17: 30 ü www. ceng. metu. edu. tr/~ys/ceng 334 -os/ //my lecture slides ü Grading ü 40%: 2 Midterm Exams. ü 20%: Final Exam. ü 40%: 3 Assignments. ü Textbook: Operating System Concepts. ü Instructor: Yusuf Sahillioğlu (ys@ceng. metu. edu. tr) (office: B 107)

About the Course 3 / 28 ü Learn ü Concepts and components of OSs.

About the Course 3 / 28 ü Learn ü Concepts and components of OSs. ü Code ü 3 programming assignments in C. ü Case study ü Unix.

What’s an Operating System? 4 / 28 ü A program that acts as an

What’s an Operating System? 4 / 28 ü A program that acts as an intermediary between a user of a computer(ized device) and the computer(ized device) hardware. ü Objectives ü Abstraction – Hides details of different hardware configurations. ü Develop programs easier. ü Arbitration – Manages access to shared hardware resources. ü Execute user programs and use computer hw efficiently.

Abstraction 5 / 28 ü Apps do not have to be tailored for each

Abstraction 5 / 28 ü Apps do not have to be tailored for each possible device in the system. App: FM Computer 1: Dell App: FM Computer 2: Acer

Abstraction 6 / 28 ü Apps do not have to be tailored for each

Abstraction 6 / 28 ü Apps do not have to be tailored for each possible device in the system. App: FM OS OS Computer 1: Dell Computer 2: Acer

Abstraction 7 / 28 ü Apps communicate with OS through Libraries; so we only

Abstraction 7 / 28 ü Apps communicate with OS through Libraries; so we only have to code according to the API of the library in use, e. g. , Open. GL, Qt, STL.

Arbitration 8 / 28 ü Multiple apps share the same hardware resources simultaneously (use

Arbitration 8 / 28 ü Multiple apps share the same hardware resources simultaneously (use hw efficiently). ü These managers of OS work together like a team to get jobs done.

Arbitration 9 / 28 ü Memory manager. ü Allows allocation and deallocation of memory

Arbitration 9 / 28 ü Memory manager. ü Allows allocation and deallocation of memory space.

Arbitration 10 / 28 ü Process manager. ü Decides how to allocate the brain

Arbitration 10 / 28 ü Process manager. ü Decides how to allocate the brain of the computer, the CPU.

Arbitration 11 / 28 ü Device manager. ü Monitors every device connected to the

Arbitration 11 / 28 ü Device manager. ü Monitors every device connected to the system.

Arbitration 12 / 28 ü File manager. ü Sets permissions so that certain users

Arbitration 12 / 28 ü File manager. ü Sets permissions so that certain users can only see certain files.

Computer System Structure 13 / 28 ü Hardware. ü CPU, memory, I/O devices. ü

Computer System Structure 13 / 28 ü Hardware. ü CPU, memory, I/O devices. ü Operating system. ü Controls use of HW among apps and users. ü App programs. ü Word processors, games, compilers, browsers. ü Users. ü People, other computers.

Computer System Structure 14 / 28

Computer System Structure 14 / 28

OS Goals/Objectives 15 / 28 ü Decides who (process) should use which resource (CPU,

OS Goals/Objectives 15 / 28 ü Decides who (process) should use which resource (CPU, file). ü Resolve conflictions and fairness for resource usage. ü Controls processes (program in execution) so that they don’t harm each other; single CPU, memory, etc. shared robustly. ü OS has the low level code that knows how to access devices, which makes program development easy for us. ü Your printf() triggers some OS routine to run in the CPU to do the actual I/O: send something to video card which goes to the screen.

OS Definition 16 / 28 ü Kernel: to be studied in this course! ü

OS Definition 16 / 28 ü Kernel: to be studied in this course! ü The one program running at all times on the computer.

Computer Startup 17 / 28 ü bootstrap program is loaded at power-up. ü ü

Computer Startup 17 / 28 ü bootstrap program is loaded at power-up. ü ü Typically stored in ROM. Also known as firmware. Initializes all aspects of the system. Loads OS kernel (to memory) and starts execution.

Interrupt-Driven OS 18 / 28 ü CPU is either idle or used by application

Interrupt-Driven OS 18 / 28 ü CPU is either idle or used by application programs. ü Then an interrupt comes and activates kernel code. ü

What’s really going on under the hood? 19 / 28 ü a = a

What’s really going on under the hood? 19 / 28 ü a = a + 1; //C code ü ü 0000001 00010 00110 00000 100000 //compiled into machine code OS knows how to feed this into the CPU, may it be AMD or Intel. CPU performs the instruction when OS process manager permits. OS knows how to give the CPU output to the C code (via C library). ü Inside the case (Computer Architecture course):

What’s really going on under the hood? 20 / 28 ü Inside CPU: lots

What’s really going on under the hood? 20 / 28 ü Inside CPU: lots of transistors (semi-conductors).

What’s really going on under the hood? 21 / 28 ü Inside CPU: transistors

What’s really going on under the hood? 21 / 28 ü Inside CPU: transistors in action; Full Adder to add binary numbers. ü 0110011 + 0000001 = 0110100 XOR: 1 whence only 1 of the inputs is 1

What’s really going on under the hood? 22 / 28 ü Inside CPU: transistors

What’s really going on under the hood? 22 / 28 ü Inside CPU: transistors in action; Full Adder to add binary numbers. ü 0110011 + 0000001 = 0110100 1 + 0 = 01 //in binary; similarly 0 + 1 = 01

What’s really going on under the hood? 23 / 28 ü Inside CPU: transistors

What’s really going on under the hood? 23 / 28 ü Inside CPU: transistors in action; Full Adder to add binary numbers. ü 0110011 + 0000001 = 0110100 1 + 1 = 10 //in binary

What’s really going on under the hood? 24 / 28 ü Inside CPU: transistors

What’s really going on under the hood? 24 / 28 ü Inside CPU: transistors in action; Full Adder to add binary numbers. ü 0110011 + 0000001 = 0110100 1 + 1 = 10 //in binary; extension: leftmost 1 must be carried out to the next full adder.

What’s really going on under the hood? 25 / 28 ü Inside CPU: transistors

What’s really going on under the hood? 25 / 28 ü Inside CPU: transistors in action; Full Adder to add binary numbers. ü 0110011 + 0000001 = 0110100 2 half adders make the final full adder

Abstraction or Arbitration? 26 / 28 ü ü ü Supporting both Intel and AMD

Abstraction or Arbitration? 26 / 28 ü ü ü Supporting both Intel and AMD processors. Switching between apps. Separating memory allocated to different apps. Enabling Skype to use different camera devices. Accessing two different hard disks.

Multiple Operating Systems. 27 / 28 ü DOS/NT Unix-based (others: BSD, Solaris) ü Tablet

Multiple Operating Systems. 27 / 28 ü DOS/NT Unix-based (others: BSD, Solaris) ü Tablet devices made Unix-based OS as popular as Windows. ü Embedded systems: ü ü Android (embedded-linux). i. OS (based on Apple’s Mac OS). Blackberry OS. Symbian (Samsung, Nokia).

Multiple Operating Systems. 28 / 28 ü Linux: same unix-based kernel, different distributions. ü

Multiple Operating Systems. 28 / 28 ü Linux: same unix-based kernel, different distributions. ü Ubuntu, Debian, Red Hat, Fedora, Open. SUSE, Slackware, Gentoo, etc. ü Kernel developed by undergrad Linus Torvalds (U of Helsinki, 91). ü Naming: Free, freak, x Freax vs. Linux (egostical).