CIS-3207 Sections 001, 002, 004 Introduction to Systems Programming and Operating Systems Professor Gene Kwatny Fall 2023 Welcome to 3207: Introduction to Systems Programming & Operating Systems Login to Canvas for start of class Attendance via Qwickley Course FAQ Introduction to the Course Review of Syllabus & materials in the Canvas site Course Participation Come to class with questions [even when not assigned] Introductory Lab (8/30): Starting with git & Github; program development 3207 FAQ 3207 has a reputation as a difficult course • This course does have a lot of work: there are lots of new concepts; there is significant programming • CIS courses with new and deeper concepts require at least 3 hours per credit per week of work • Understanding just the surface is not enough Some people may think there is a disconnect between the lectures and lab projects • Not True; the course is about OS and systems programming • In lecture we discuss concepts, features, mechanisms and policies of OS and systems programming • In lab we demonstrate using systems programming to exploit the features and concepts How do you study for this course? • Review the class slides and the content in the modules the evening after each class. • Before the class (previous evening or in morning) spend ½ hour reviewing the last lecture & what you have been reading • Don't just read the material - create an outline from the slides & readings of the key points and write your own notes on those points. • Pose questions for yourself. Those that you cannot answer, bring to class, or ask in the discussion board, discord or email to me. Come to Office Hours • Discuss concepts with classmates • Be active, not passive about learning the material The labs are your principal out of class active work • You must spend time in the first 2 weeks refreshing your programming and knowledge of C/C++ • If you did not program last semester or in the last year, you need to put in even more time • The first projects are to help get you thinking and programming • Don’t Procrastinate. Get started immediately on a project and work on it at least every other day. • Ask for Help • Class Discord: https://discord.gg/BZEZhPFaB6 Success in the course means understanding the concepts and being able to use them • To be successful, you must be an active participant • Stay up to date • Ask questions Course Description and Goal CIS 3207 is a course about Systems Programming and about Operating Systems. These are two very related topics: One, operating systems, is concerned with a very large, mostly invisible, program that transforms or manages the devices and resources that comprise the computer system. The other topic, systems programming, is concerned with writing programs that interact with and make direct use of the operating system services. Course Description and Goal Course Goals • introduce the basic concepts, features and components of operating systems; • focus on understanding, applying and implementing operating systems features • introduce the most important computer architectural issues impacting operating system design and implementation. • The laboratory portion of the course is based on experiments and assignments implementing and applying operating system mechanisms and components. • The course will be an opportunity to strengthen your software development abilities and your use of the C/C++ languages in problem solution • introduce you to the use of operating system libraries and system calls. CIS 3207 -- logistics Instructor: Dr. Gene Kwatny Office: SERC 324, 1679 Phone: (215)-204- Email: gkwatny@temple.edu Lectures: T/Th (12:30 am – 1:50 pm) Place: Beury 160 Office hours: M (11 - 12 ), Th (2:30 – 3:30) Section 001 TA: Parth Patel Section 002 TA: Neil Conley Section: 004 TA: Sydney Kimbell Textbooks: ‘Operating Systems: Three Easy Pieces’; ‘Computer Systems: A programmer’s perspective’ Course Objective: at the end of the course, you should 1. have a good overview of the various components of an operating system and their functionality. 2. Understand the role of abstraction and virtualization of the CPU, memory and persistent storage 3. Understand concurrency, synchronization, virtual memory, CPU scheduling, persistent storage 4. Have knowledge of system APIs and experience in using them CIS 3207 Introduction Systems Programming & Operating Systems The What, The Why and The How of OS The What: This course will introduce the basic components that make up modern operating systems, the special computer architectural features required to make these components work and work efficiently, and the programming interface to control the operating system components. What is an Operating System ? Not Easily Defined Large Sophisticated Program Creates an effectively different computer Users Users Applications Operating System Applications Hardware Computer System • [Simple] Software that converts hardware into something more useful for applications, or • the OS is the body of software in charge of making sure the system operates correctly and efficiently in an easy-to-use manner, or • the OS is the software that runs on the bare hardware of a computer and provides essential support for users to develop and use applications in the most efficient and safe manner The What, The Why and The How of Studying OS The Why: Most computer programs are developed to execute on a computer system that consists of the computer hardware and a program to control the hardware (the OS). Understanding the features, capabilities and limitations of the computer system is important to the efficient execution to the applications. Through the systems programming interface (the API), we can better control and understand the OS and thus the computer system. The How: See course Syllabus & Logistics The System Call Mechanism 1. A key part of understanding how the OS transforms a ‘computer’ into a new computer system. 2. A class of system calls are “supervisor calls” implemented in the OS kernel. 3. The OS kernel, or core, is the privileged owner of all system resources and devices. Some Introductory Perspective • The relationship between programs, the CPU and other devices is critical to our effective use of a computer system • Program – static instructions that we develop to control the CPU • CPU: Fetch, Decode, Execute • Program executes by moving through instructions and memory driven by results of execution • Computer system has devices other than the CPU: Memory, Disks, other I/O, network, etc. Hardware Organization of a Computer System CPU chip Registers ALU system bus memory bus main memory I/O bridge MI Expansion slots I/O bus USB controller mouse keyboard graphics adapter disk controller network adapter disk network monitor Do I always need an OS? What if I want to run more than 1 program at a time? What if I want to run 1 program but my computer has 2 CPUs? How do I have 2 programs safely share memory? What if my program is too large for the memory in my computer? OSs use Abstraction to create hierarchies of objects where multiple operations at one level are combined into a single operation at a higher level, thus hiding the details of the implementation and making the operation easier to use. Abstraction unifies and simplifies by combining multiple simpler objects into more complex ones. We See This With System Calls; or, a program that has more than 1 executable unit. OSs rely on Virtualization to create CPUs, memory, I/O devices, and other system components that facilitate the work of programmers and users. Virtualization creates illusions of objects with more favorable characteristics. The OS takes a physical resource (such as the processor, or memory, or a disk) and transforms it into a more general, powerful, and easyto-use virtual form of itself. Each executing program “thinks” it has a complete private CPU Each program “thinks” it has all of the primary memory. An OS is an extended machine: • virtual entities that liberate the programmer and the user • Programmers do not need to understand details of control of memory, disk, I/O management, and other internal processes. • efficient high-level features beyond what the hardware provides The OS as a Resource Manager A main task of an OS - optimize the use of all computational resources: • ensure good overall • meet application performance requirements • guarantee acceptable • meet deadlines of timeresponse times for interactive critical tasks processes • allow safe communication among different tasks Program Behavior Guides OS Design • A program alternates between phases of input, computation, and output. • Leaves the CPU underutilized during the I/O phases; I/O devices are idle during the compute phase. • Parallelization can improve overall performance of all applications • OS strives to keep the CPU, main memory, and all storage and I/O devices busy at all times by overlapping independent operations whenever possible. Multiprogramming • Technique that keeps several programs active in memory and switches execution among the different programs to maximize the use of the CPU and other resources. Parallelizing Operations Timesharing • An extension of multiprogramming where the CPU is switched periodically among all active computations to guarantee acceptable response times to each user. Time-sharing employs the concept of virtualization by creating the illusion of having a separate virtual CPU for each computation. A A B