CSS307-System Programminginstructor.sdu.edu.kz/~konst/sysprog2015fall/... · UNIX OS A multi-user...
Transcript of CSS307-System Programminginstructor.sdu.edu.kz/~konst/sysprog2015fall/... · UNIX OS A multi-user...
CSS307-System ProgrammingSuleyman Demirel University
Fall 2015by Konstantin Latuta & EN3[ABCD]04
Summary of week 1, 2 and 3
Outline
● Big picture of relevant knowledge areas● Hardware organization of computer system● Operating system concepts● UNIX history and concepts● Introduction to Linux● Why to study System Programming● Grading policy and syllabus
UNIX/Linuxsystem programming
computer organization& architectureoperating systems
concepts
working knowledgeof UNIX/Linux
and C programming
relevant knowledge areas
our class
Hardware Organization of Computer System
A modern computer system by A. Silberschatz et al, “Operating Systems Concepts: Essentials”
Hardware Organization of Computer System
Hardware Organization of Computer System
● Buses– collection of electrical conduits that carry bytes of information back
and forth between the components
– transfer fixed-sized chunks of bytes known as words, for example 32 bits or 64 bits
● I/O devices– Keyboard, mouse, display, disk drive, network adapter
Hardware Organization of Computer System
● Main memory– temporary storage device that holds both a program and the data it
manipulates while the processor is executing the program
– DRAM
● Processor (Central Processing Unit)– the engine that interprets (or executes) instructions stored in main memory.
– contains a set of registers that helps it operate
– Arithmetic Logical Unit inside the CPU operates on registers and stores a result back to registers
The truth about memory...
Cache...
Computer system is not just hardware
Operating Systems Concepts
● OS has 2 main goals– To protect the hardware from misuse by application programs...
– To provide applications with simple and uniform mechanisms for manipulating complicated and often wildly different low-level hardware devices
● The goals are achieved by several abstractions– processes, virtual memory and files
Abstractions provided by operating system
Process
● A process is the operating system’s abstraction for a running program– Illusion of exclusive use of the processor, main memory, and I/O
devices
Virtual Memory
● An illusion provided to process that it has an exclusive use of the main memory.– each process has a uniform view of
memory called virtual address space
Files
● A file is a sequence of bytes, nothing more and nothing less– every I/O device, including disks, keyboards, displays, and even
networks, is modeled as a file
UNIX OS
● A multi-user and multi-tasking operating system that dates back to 1969 at AT&T Bell Labs.– multi-user: when two or more people can work on the same computer at the
same time, using different terminals● A terminal is a device with a monitor and a keyboard. (The concept is more complex
than this, but for now think of it this way. There are also special windows called pseudo-terminals.)
– multi-tasking: when two or more programs can be running on the computer at the same time
● but it does not mean there has to be more than one processor; programs may timeshare the processor
Why all the fuss about UNIX?
● UNIX is a professional operating system that lets you do sophisticated tasks easily
● It lets you customize your work environment and create new commands
● It is inherently very secure because of the way it was designed● Linux is a UNIX-like operating system that is very popular
Why UNIX became popular?
● Portable– because it was written mostly in C (a new idea for that time)
● Very small– 10,000 lines of C, and about 1,000 lines of assembler
● Free– it was distributed to universities and research laboratories for free by AT&T
● Innovative– it had many features that were not part of any other operating systems such as
shells, pipes, files etc.
User interfaces
● Graphic User Interface (GUI)● Command Line Interface (CLI)
– shell is a program that uses terminal device to bridge user and kernel
– kernel is the main part of any OSthat controls hardware etc.
kernel shell
A word to creators of UNIX
● The success of UNIX lies not so much in new inventions but rather in the full exploitation of a carefully selected set of fertile ideas, and especially in showing that they can be keys to the implementation of a small yet powerful operating system.– Ken Thompson, Dennis Ritchie
● fertile ideas– files and file hierarchy, processes, users and groups, priviledged and
non-priviledged instructions, environments, device independent input/output...
Linux OS
● Linux is a free open source operating system initially intended for Intel x86-based PCs
● 1991, Linus Torvalds, a student in Helsinki started writing his own OS kernel, known as Linux kernel
● 1992, Linux was re-licensed with General Public License (GPL) by GNU (a project of Free Software Foundation which promotes free software)
● Mid-90s, Linux distributions emerged● 1998, major companies announced support
Linux Philosophy
● Linux is a free and open source version of UNIX● Linux is maintained by a network of developers from all
over the world● Hierarchical filesystem with the top node / (aka root)● Everything is a file (or a file-like object)● Fully multitasking and multiuser OS
https://www.youtube.com/watch?v=H7Uz692S6T4https://www.youtube.com/watch?v=RaFNXQ8Dat0https://www.youtube.com/watch?v=_C-GAkLPAAc
Linux Distributions
● Linux kernel is the core of a computer operating system (www.kernel.org)
● Linux distribution = kernel + some software tools– File management, user management, software package management
tools
● commercially supported distributions: Red Hat, SUSE, Ubuntu● free: CentOS, Fedora, Ubuntu, openSUSE● And many others like Scientific Linux, Oracle Linux etc.
Distro Families
Debian Family Key Facts
● The Debian family is upstream for Ubuntu, and Ubuntu is upstream for Linux Mint and others.
● The Linux kernel 3.13 is used in Ubuntu 14.04.● It uses the DPKG-based apt-get package manager
(we cover in more detail later) to install, update, and remove packages in the system.
● Ubuntu has been widely used for cloud deployments.● While Ubuntu is built on top of Debian, it uses the
Unity graphical interface, is GNOME-based and differs quite a bit visually from the interface on standard Debian as well as other distributions.
Fedora Family Key Facts
● The Fedora family is upstream for CentOS, RHEL, and Oracle Linux.
● The Linux kernel 2.6.32 is used in RHEL/CentOS 6.x● It supports hardware platforms such as x86, x86-64,
Itanium, PowerPC, and IBM System z.● It uses the RPM-based yum package manager (we
cover in more detail later) to install, update, and remove packages in the system.
● RHEL is widely used by enterprises which host their own systems.
SUSE Family Key Facts
● SUSE Linux Enterprise Server (SLES) is upstream for openSUSE.
● The Linux kernel 3.11 is used in openSUSE 12.3.● It uses the RPM-based zypper package manager
to install, update, and remove packages in the system.
● It includes the YaST (Yet another System Tool) application for system administration purposes.
● SUSE is widely used in the retail sector.
System Programming
● System programming is the practice of writing system software● System software lives at a low level, interfacing directly with the
kernel and core system libraries● Kernel is the only software that runs all the time on computer
– it is the core of operating system with everything else being system or application software
Why to learn system programming?
● System programmers develop an acute awareness of the hardware and the operating system on which they work
● Application programmers write in Java, JavaScript etc. but someone still has to write the JavaScript interpreter and the Java VM
● Developer writing Python or Ruby or Scala can still benefit from knowledge of system programming, as an understanding of the soul of the machine
Grading Policy and Tentative Syllabus
● 40% Labs and Quizzes● 20% Midterm exam● 20% Final Exam● 20% creative t-shirt project● Portal View:
– 30% = L&Q/2 + M/2
– 30% = L&Q/2 + M/2
– 40% = F + t-shirt
References
● Operating Systems Concepts Essentials, 2nd edition, Abraham Silberschatz et al., 2014
● Computer systems: a programmer’s perspective, Randal E. Bryant, David R. O’Hallaron, 2nd edition, 2011
● UNIX Application and System Programming lecture notes, Steward Weiss, 2013
● Linux Foundation course on edX.org● Linux System Programming, 2nd edition, Robert Love, 2013● Understanding UNIX/Linux programming, Bruce Molay, 2003