CENG 334 Introduction to Operating Systems Introduction Topics

  • Slides: 26
Download presentation
CENG 334 Introduction to Operating Systems Introduction Topics • What’s an operating system? •

CENG 334 Introduction to Operating Systems Introduction Topics • What’s an operating system? • Course policy Erol Sahin Dept of Computer Eng. Middle East Technical University Ankara, TURKEY URL: http: //kovan. ceng. metu. edu. tr/~erol/Courses/CENG 334 Week 1 2/21/2021 1

Typical Organization of System CPU Register file PC ALU System bus Memory bus Main

Typical Organization of System CPU Register file PC ALU System bus Memory bus Main memory I/O bridge Bus interface I/O bus USB controller Mouse Keyboard Graphics adapter Disk controller Display Disk Expansion slots for other devices such as network adapters hello executable stored on disk Week 1 2/21/2021 2

How do we tame complexity? • Every piece of computer hardware different – Different

How do we tame complexity? • Every piece of computer hardware different – Different CPU • Pentium, Power. PC, Cold. Fire, ARM, MIPS – Different amounts of memory, disk, … – Different types of devices • Mice, Keyboards, Sensors, Cameras, Fingerprint readers – Different networking environment • Cable, DSL, Wireless, Firewalls, … • Questions: – Does the programmer need to write a single program that performs many independent activities? – Does every program have to be altered for every piece of hardware? – Does a faulty program crash everything? – Does every program have access to all hardware? Adapted from J. Kubiatowicz ‘s slides, © UCB 2005 Week 1 2/21/2021 3

OS Tool: Virtual Machine Abstraction Application Virtual Machine Interface Operating System Hardware Physical Machine

OS Tool: Virtual Machine Abstraction Application Virtual Machine Interface Operating System Hardware Physical Machine Interface • Software Engineering Problem: – Turn hardware/software quirks what programmers want/need – Optimize for convenience, utilization, security, reliability, etc… • For Any OS area (e. g. file systems, virtual memory, networking, scheduling): – What’s the hardware interface? (physical reality) – What’s the application interface? (nicer abstraction) Adapted from J. Kubiatowicz ‘s slides, © UCB 2005 Week 1 2/21/2021 4

Interfaces Provide Important Boundaries software instruction set hardware • Why do interfaces look the

Interfaces Provide Important Boundaries software instruction set hardware • Why do interfaces look the way that they do? – History, – Functionality, – Stupidity, – Bugs, – Management Adapted from J. Kubiatowicz ‘s slides, © UCB 2005 Week 1 2/21/2021 5

Virtual Machines • Software emulation of an abstract machine – Make it look like

Virtual Machines • Software emulation of an abstract machine – Make it look like hardware has features you want – Programs from one hardware & OS on another one • Programming simplicity – – Each process thinks it has all memory/CPU time Each process thinks it owns all devices Different Devices appear to have same interface Device Interfaces more powerful than raw hardware • Bitmapped display windowing system • Ethernet card reliable, ordered, networking (TCP/IP) • Fault Isolation – Processes unable to directly impact other processes – Bugs cannot crash whole machine • Protection and Portability – Java interface safe and stable across many platforms Adapted from J. Kubiatowicz ‘s slides, © UCB 2005 Week 1 2/21/2021 6

Four Components of a Computer System Definition: An operating system implements a virtual machine

Four Components of a Computer System Definition: An operating system implements a virtual machine that is (hopefully) easier and safer to program and use than the raw hardware. Adapted from J. Kubiatowicz ‘s slides, © UCB 2005 Week 1 2/21/2021 7

OS Systems Principles • OS as illusionist: – Make hardware limitations go away –

OS Systems Principles • OS as illusionist: – Make hardware limitations go away – Provide illusion of dedicated machine with infinite memory and infinite processors • OS as government: – Protect users from each other – Allocate resources efficiently and fairly • OS as complex system: – Constant tension between simplicity and functionality or performance • OS as history teacher – Learn from past – Adapt as hardware tradeoffs change Adapted from J. Kubiatowicz ‘s slides, © UCB 2005 Week 1 2/21/2021 8

Operating System • Operating systems provide a virtual machine abstraction to handle diverse hardware

Operating System • Operating systems provide a virtual machine abstraction to handle diverse hardware • Operating systems coordinate resources and protect users from each other • Operating systems simplify application development by providing standard services • Operating systems can provide an array of fault containment, fault tolerance, and fault recovery Adapted from J. Kubiatowicz ‘s slides, © UCB 2005 Week 1 2/21/2021 9

Operating System • No universally accepted definition • “Everything a vendor ships when you

Operating System • No universally accepted definition • “Everything a vendor ships when you order an operating system” is good approximation – But varies wildly • “The one program running at all times on the computer” is the kernel. Everything else is either a system program (ships with the operating system) or an application program Week 1 2/21/2021 10

Course Organization Week 1 2/21/2021 11

Course Organization Week 1 2/21/2021 11

Teaching staff – Instructor: • Section 2: Dr. Erol Sahin – Location: B-106, Tel:

Teaching staff – Instructor: • Section 2: Dr. Erol Sahin – Location: B-106, Tel: 210 5539, – E-mail: erol@ceng – Office hours: by appointment. – Teaching assistant: • Hande Celikkanat – E-mail: hande@ceng – Schedule: • Wednesdays 9: 40 -11: 30, BMB 2 • Fridays 9: 40 -10: 30, BMB 3 Week 1 2/21/2021 12

Textbook • Operating System Concepts with Java Seventh Edition – Avi Silberschatz – Peter

Textbook • Operating System Concepts with Java Seventh Edition – Avi Silberschatz – Peter Baer Galvin – Greg Gagne • John Wiley & Sons, Inc. ISBN 0 -471 -76907 -X • Should be available at the bookstore. . Week 1 2/21/2021 13

Grading • Midterm: 25 % [April 17] • Assignments: 45 % • Final: 30

Grading • Midterm: 25 % [April 17] • Assignments: 45 % • Final: 30 % Week 1 2/21/2021 14

Assignments During this term, we will be improving a very simple, instructional OS, called

Assignments During this term, we will be improving a very simple, instructional OS, called “OS/161”. OS/161, and its simulated execution environment, “System/161” are intended to: • • provide you with a realistic execution environment facilitate easy debugging retain simplicity throughout the assignments help you to familiarize with the structure and layout of real OSes • have a complete OS at the end of the term, which is capable of running real, if small-scale, user applications on a cleanly written and robust code base. Week 1 2/21/2021 15

OS/161 & System/161 OS/161: • includes a standalone kernel and a simple userland •

OS/161 & System/161 OS/161: • includes a standalone kernel and a simple userland • all written in C • structured as a BSD-like source tree It runs on a machine simulator, System/161: • A MIPS r 2000/r 3000 simulator (actually a complete simulator, except for cache effects) which provides: • debugging support via remote gdb into the simulator • transparent kernel profiling • event tracing, as far down as the level of individual machine instructions • performance monitoring • simple but realistic bus and devices Week 1 2/21/2021 16

What we. . What you. . What we provide: • The device driver set

What we. . What you. . What we provide: • The device driver set • Absolutely minimal virtual memory system • Simple skeleton file system • One sample system call implementation • Simple round-robin scheduler • In-kernel threads package • Semaphore implementation What you will ; ) • Lock and condition-variable implementation • Process support and system call layer • More interesting schedulers • Virtual memory system • Full-featured file system Week 1 2/21/2021 17

Assignment 0: Introduction to OS/161 This assignment’s task is to familiarize you with OS/161

Assignment 0: Introduction to OS/161 This assignment’s task is to familiarize you with OS/161 and System/161. We will (kindly) expect you to: • install OS/161 • read through OS/161 code to get a better understanding of it • answer some questions about the code • build yourself a kernel, then run it, and modify it a bit • practice a little with CVS and GDB Week 1 2/21/2021 18

Assignment 1: Synchronization You will implement synchronization primitives for OS/161, and learn how to

Assignment 1: Synchronization You will implement synchronization primitives for OS/161, and learn how to use them to solve synchronization problems. What we provide to you is: • a sleep/wakeup interface to the thread system • a semaphore implementation that uses it And what we expect from you ; ) • implementation of locks and condition variables (with Mesa semantics) • usage of semaphores, locks and condition variables in synchronization problems Week 1 2/21/2021 19

Assignment 2: System Calls OS/161 system has minimal support for running executables - nothing

Assignment 2: System Calls OS/161 system has minimal support for running executables - nothing that could be considered a true process. We hereby begin to create a true multi-tasking operating system! Here, you will implement system calls and exception handling. Eventually, OS/161 will be able to run multiple processes from actual compiled programs, under the control of your kernel. So here is what you must add to : • file handles • process creation with fork • proper argument handling for execv • waiting for processes to exit (with a subset of waitpid) • termination of processes upon fatal faults • two scheduling algorithms you will choose Week 1 2/21/2021 20

Assignment 3: Virtual Memory OS/161 includes a very “dumb” virtual memory system called “dumbvm”

Assignment 3: Virtual Memory OS/161 includes a very “dumb” virtual memory system called “dumbvm” which is barely enough for the user level processes to run. In this assignment, you will write a virtual memory system, which will replace dumbvm. Your mission will be to: • write the code to manage the Translation Lookaside Buffer • add paging to your operating system: Week 1 2/21/2021 21

Assignment 4: File System Your task is to extend the skeleton file system that

Assignment 4: File System Your task is to extend the skeleton file system that is provided to you. The skeleton file system is very primitive. It lacks support for: • directories • files larger than about 72 k • multiple concurrent processes • disk cache You must remove these restrictions! We want you to: • provide support for concurrent access. • add a hierarchical directory structure. • add a buffer cache to improve performance. Week 1 2/21/2021 22

Policies • Late assignments: – Late submission policy will be announced for each assignment.

Policies • Late assignments: – Late submission policy will be announced for each assignment. • Academic dishonesty: – All assignments submitted should be fully your own. We have a zero tolerance policy on cheating and plagiarism. Your work will be regularly checked for such misconduct and any such attempts will be prosecuted: • At all times you have the right to challenge our decisions on cheating, upon which the case will be processed through the disciplinary channels of the university. However, we would like to remind you that, if found guilty, the legal code of the universityproposes a minimum of six month expelsion from the university. Week 1 2/21/2021 23

Cheating • What is cheating? – Sharing code: either by copying, retyping, looking at,

Cheating • What is cheating? – Sharing code: either by copying, retyping, looking at, or supplying a copy of a file. • What is NOT cheating? – Helping others use systems or tools. – Helping others with high-level design issues. – Helping others debug their code. Week 1 2/21/2021 24

Communication • • Online information about the course will be available on the CENG

Communication • • Online information about the course will be available on the CENG 334 web page: http: //kovan. ceng. metu. edu. tr/~erol/Courses/CENG 334/ Announcements about the course will be made at the CENG 334 newsgroup at news: //metu. ceng. course. 334 Please put Section 2 on the subject line of your posting. If you have a specific question you can send an e-mail to the us. However make sure that the subject line starts with CENG 334 [capital letters, and no spaces] to get faster reply. Week 1 2/21/2021 25

Assignment groups • Maximum three students… Week 1 2/21/2021 26

Assignment groups • Maximum three students… Week 1 2/21/2021 26