CSC414 “Introduction to UNIX/ Linux” Lecture 2. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.

Slides:



Advertisements
Similar presentations
Operating-System Structures
Advertisements

Device Drivers. Linux Device Drivers Linux supports three types of hardware device: character, block and network –character devices: R/W without buffering.
Devices and Drivers (Chapter 7) Khattab Alhabashi UNIX System Administration.
Operating System Structures
Chorus Vs Unix Operating Systems Overview Introduction Design Principles Programmer Interface User Interface Process Management Memory Management File.
Chap 2 System Structures.
Operating System Structure
Operating-System Structures
Introduction to Kernel
Embedded System Programming Introduction to Device Drivers.
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
Embedded Real-time Systems The Linux kernel. The Operating System Kernel Resident in memory, privileged mode System calls offer general purpose services.
Figure 1.1 Interaction between applications and the operating system.
Common System Components
Comparative Operating Systems Understanding the Kernel Structure Prashant Thuppala.
OPERATING SYSTEMS Introduction
Introduction Operating Systems’ Concepts and Structure Lecture 1 ~ Spring, 2008 ~ Spring, 2008TUCN. Operating Systems. Lecture 1.
1 I/O Management in Representative Operating Systems.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 2: Operating-System Structures Modified from the text book.
Copyright Arshi Khan1 System Programming Instructor Arshi Khan.
An Introduction to Device Drivers Sarah Diesburg COP 5641 / CIS 4930.
Chapter 3 Operating Systems Introduction to CS 1 st Semester, 2015 Sanghyun Park.
Chapter 3 Process Description and Control Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Chapter 3 Process Description and Control Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
CSC 322 Operating Systems Concepts Lecture - 25: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
COMP 3438 – Part I - Lecture 4 Introduction to Device Drivers Dr. Zili Shao Department of Computing The Hong Kong Polytechnic Univ.
1 Lecture 20: I/O n I/O hardware n I/O structure n communication with controllers n device interrupts n device drivers n streams.
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS6: Device Management 6.1. Principles of I/O.
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 14, 2005 Operating System.
OS provide a user-friendly environment and manage resources of the computer system. Operating systems manage: –Processes –Memory –Storage –I/O subsystem.
Introduction to Operating Systems Chapter 1. cs431 -cotter2 Lecture Objectives Understand the relationship between computing hardware, operating system,
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 2: Operating-System Structures Operating.
Chapter 2 Operating System Overview
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Operating-System Structures System Components Operating System Services.
Chapter 1 : The Linux System Part 1 Lecture 1 10/21/
CE Operating Systems Lecture 3 Overview of OS functions and structure.
30 October Agenda for Today Introduction and purpose of the course Introduction and purpose of the course Organization of a computer system Organization.
LINUX System : Lecture 7 Bong-Soo Sohn Lecture notes acknowledgement : The design of UNIX Operating System.
Linux Kernel Management. Module 9 – Kernel Administration ♦ Overview The innermost layer of Linux operating system is the kernel, which is a thin layer.
Operating System Principles And Multitasking
An Introduction to Device Drivers Ted Baker  Andy Wang COP 5641 / CIS 4930.
UNIX Unit 1- Architecture of Unix - By Pratima.
System Components ● There are three main protected modules of the System  The Hardware Abstraction Layer ● A virtual machine to configure all devices.
UNIX & Windows NT Name: Jing Bai ID: Date:8/28/00.
1 Process Description and Control Chapter 3. 2 Process A program in execution An instance of a program running on a computer The entity that can be assigned.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 2: The Linux System Part 2.
CSC414 “Introduction to UNIX/ Linux” Lecture 3
Operating Systems: Summary INF1060: Introduction to Operating Systems and Data Communication.
MINIX Presented by: Clinton Morse, Joseph Paetz, Theresa Sullivan, and Angela Volk.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 2: The Linux System Part 5.
Kernel Modules – Introduction CSC/ECE 573, Sections 001 Fall, 2012.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Introduction to Operating Systems Concepts
Introduction to Kernel
Chapter 13: I/O Systems Modified by Dr. Neerja Mhaskar for CS 3SH3.
Linux Kernel Module Programming
Chapter 2: System Structures
Operating System I/O System Monday, August 11, 2008.
Introduction to the Kernel and Device Drivers
An Introduction to Device Drivers
Chapter 2: The Linux System Part 2
Chapter 2: System Structures
CS703 - Advanced Operating Systems
Chapter 2: Operating-System Structures
Chapter 2: The Linux System Part 5
Operating Systems Lecture 1.
Introduction to Operating Systems
LINUX System : Lecture 7 Lecture notes acknowledgement : The design of UNIX Operating System.
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Presentation transcript:

CSC414 “Introduction to UNIX/ Linux” Lecture 2

Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage Structure. 4. Processes and Inter- Process Communication. 5. Shell Programming. 6. User Management and Disk Quota. 7. System Management. 8. Network Management. 9. Security. 10. Advanced System Administration. 2015Qassim University, College of Computer, 9th level 2

Contents: Linux Kernel Overview Structure. modules Device Drivers Overview Types attributes. Interfacing Device Drivers with the Kernel 2015Qassim University, College of Computer, 9th level 3

Linux Kernel  The kernel hides the system’s hardware underneath an abstract, high-level programming interface.  Written mostly in C, with a sprinkling of assembly language to help it interface with hardware- or chip- specific functions that are not accessible through normal compiler directives. 2015Qassim University, College of Computer, 9th level 4

Cont.  the kernel creates all the following concepts from lower-level hardware features: Processes (time-sharing, protected address spaces) Signals and semaphores Virtual memory (swapping, paging, mapping) The filesystem (files, directories, namespace) General input/output (specialty hardware, keyboard, mouse, USB) Interprocess communication (pipes and network connections) 2015Qassim University, College of Computer, 9th level 5

How the Kernel knows about the system's hardware?. Informed by the system admin/ developer about the hardware it should expect to find.. Prospects for many devices on its own, either at boot time or dynamically (once the system is running) 2015Qassim University, College of Computer, 9th level 6

Kernel Structure Almost all Unix platforms run monolithic kernels. The entire operating system runs in kernel space, a section of memory reserved for privileged operating system functions. Services such as device drivers, interprocess communication, virtual memory, and scheduling run in the same address space. 2015Qassim University, College of Computer, 9th level 7

Modules: Modern monolithic kernels support on-demand loading of modules. Incorporate device drivers and other kernel functions as needed without rebuilding the kernel and rebooting. Drivers, filesystems, and new system calls are all commonly implemented as modules. The memory used by a module is allocated and freed as the code is loaded or removed, using the insmod and rmmod commands. Useful for embedded systems with limited memory. 2015Qassim University, College of Computer, 9th level 8

How to load a kernel module? Two ways: 1. Use the insmod command to manually insert the it into the kernel. 2. Load the module as it is needed; this is known as demand loading. To view the status of modules in the Linux Kernel: lsmod To view a module information use the commend modinfo (module name) Demand loaded kernel modules are normally kept in /lib/modules/kernel-version 2015Qassim University, College of Computer, 9th level 9

Cont. When the kernel discovers the need for a module, it will request that the kernel daemon (kerneld) attempts to load it. The kernel daemon is a normal user process with super user privileges. When it is started up, usually at system boot time, it opens up an Inter-Process Communication (IPC) channel to the kernel. This link is used by the kernel to send messages to the kerneld asking for various tasks to be performed. Kerneld does not perform these tasks itself, it runs the neccessary programs such as insmod to do the work. 2015Qassim University, College of Computer, 9th level 10

Drivers and Device Files A device driver is a program that manages the system’s interaction with a particular type of hardware. Translates between the hardware commands understood by the device and the stylized programming interface used by the kernel. It keeps the kernel reasonably device independent. It is part of the kernel, can be accessed both from within the kernel and from user space Device drivers are system specific 2015Qassim University, College of Computer, 9th level 11

Devices Types: 2015Qassim University, College of Computer, 9th level 12 Character devices: are read and written directly without buffering, for example the system's serial ports /dev/cua0 and /dev/cua1. Block devices: can only be written to and read from in multiples of the block size, typically 512 or 1024 bytes. Block devices can be accessed via their device special file but more commonly they are accessed via the file system. Only a block device can support a mounted file system. Network devices: are accessed via the BSD socket

Attributes 2015Qassim University, College of Computer, 9th level 13 kernel code: Device drivers are part of the kernel and, like other code within the kernel, if they go wrong they can seriously damage the system. A badly written driver may even crash the system, possibly corrupting file systems and losing data. Kernel interfaces: Device drivers must provide a standard interface to the Linux kernel or to the subsystem that they are part of. For example, the terminal driver provides a file I/O interface to the Linux kernel and a SCSI device driver provides a SCSI device interface to the SCSI subsystem which, in turn, provides both file I/O and buffer cache interfaces to the kernel. Kernel mechanisms and services: Device drivers make use of standard kernel services such as memory allocation, interrupt delivery and wait queues to operate.

Cont. Loadable: Most of the Linux device drivers can be loaded on demand as kernel modules when they are needed and unloaded when they are no longer being used. This makes the kernel very adaptable and efficient with the system's resources. Configurable: Linux device drivers can be built into the kernel. Which devices are built is configurable when the kernel is compiled. Dynamic: As the system boots and each device driver is initialized it looks for the hardware devices that it is controlling. It does not matter if the device being controlled by a particular device driver does not exist. In this case the device driver is simply redundant and causes no harm apart from occupying a little of the system's memory. 2015Qassim University, College of Computer, 9th level 14

Where to find the device files? Most devices have a corresponding file in /dev. Files in /dev each have a major and minor device number associated with them. The kernel uses these numbers to map device-file references to the corresponding driver. The major device number identifies the driver with which the file is associated (in other words, the type of device). The minor device number usually identifies which particular instance of a given device type is to be addressed. The minor device number is sometimes called the unit number. 2015Qassim University, College of Computer, 9th level 15

Where to find the device files? You can see the major and minor number of a device file with ls -l: This example shows the first SCSI disk on a Linux system. It has a major number of 8 and a minor number of Qassim University, College of Computer, 9th level 16

Interfacing Device Drivers with the Kernel The Linux kernel must be able to interact with the drivers in standard ways. Each class of device driver, character, block and network, provides common interfaces that the kernel uses when requesting services from them. The kernel can treat often very different devices and their device drivers absolutely the same. For example, SCSI and IDE disks behave very differently but the Linux kernel uses the same interface to both of them. 2015Qassim University, College of Computer, 9th level 17

Interfacing Device Drivers with the Kernel Every time a Linux kernel boots it may encounter different physical devices and thus need different device drivers. Linux allows to include device drivers at kernel build time via its configuration scripts. When these drivers are initialized at boot time they may not discover any hardware to control. Other drivers can be loaded as kernel modules when they are needed. Device drivers register themselves with the kernel as they are initialized. Linux maintains tables of registered device drivers as part of its interfaces with them. These tables include pointers to routines and information that support the interface with that class of devices. 2015Qassim University, College of Computer, 9th level 18

Reading Chapter 13 form “ Unix® and Linux® System Administration Handbook, Fourth Edition, Video Enhanced Edition”. The Linux Kernel on the tld Project ( 2015Qassim University, College of Computer, 9th level 19