Presentation is loading. Please wait.

Presentation is loading. Please wait.

WHY AN OPERATING SYSTEM (OS) OS interacts with hardware and manages programs. Programs not expected to know which hardware they will run on. Must be possible.

Similar presentations


Presentation on theme: "WHY AN OPERATING SYSTEM (OS) OS interacts with hardware and manages programs. Programs not expected to know which hardware they will run on. Must be possible."— Presentation transcript:

1 WHY AN OPERATING SYSTEM (OS) OS interacts with hardware and manages programs. Programs not expected to know which hardware they will run on. Must be possible to change hardware without changing the programs. Programs can’t manage themselves. OS provides a safe environment for programs to run.

2 HISTORY OF UNIX In 1965, the AT & T Bell Telephone Laboratories, General Electric and MIT develop the Multics (Multiplexed Information and Computing Service) operating systems. In 1969, Ken Thompson and Dennis Ritchie, created the UNICS (Uniplexed Information and Computing system) on a PDP-7. Brian Kernighan in 1970, renamed UNIX and moved to the PDP 11 In 1984,Berkeley at University of California developed BSD (Berkeley Software Distribution) Unix. MIT introduced X Windows, the first graphical user interface for UNIX 1991 – Linus Torvalds created LINUX

3 UNIX FEATURES Why is it so popular? Open Source Multitasking Multiuser Portable (PCs, Mainframes, Super-Computers) Network Applications Pattern Matching, Recognition Easy to program (Scripts)

4 Security Unix provides three levels of security: 1.By assigning password and login to individual user 2.File level security by give permission like read, write, execute. 3.File Encryption: The file encoded into a unreadable form. Note: Everything in the UNIX is created as a file.

5 Shell Tools and Applications UNIX ARCHITECTURE Kernel Hardware

6 Hardware is surrounded by the OS software OS is called the system kernel The kernel is the core of an OS & manages the machines, hardware resources (including the processor and the memory), and provides & controls the way any other software component can access these resources The kernel runs with a higher privilege than other programs (so called user-mode programs) Comes with a number of user services and interfaces  Shell – It is the “command interpreter” of the operating system. It acts as a middleman between the kernel and the user of the operating system  Components of the C compiler  GUI or command line interface

7 Libraries System call interface File subsystem Inter process communication Buffer cache CharacterBlock Device drivers Hardware control Hardware User level Kernel level User programs Kernel level Hardware level Scheduler Memory Management Process Control Subsystem KERNEL ARCHITECTURE

8 UNIX COMMANDS AND LIBRARIES Users gain access to specific kernel functions through UNIX commands OS contains primitive routines that allow direct hardware access Provides interface for user interaction

9 SYSTEM CALL INTERFACE User services & interfaces are considered as part of OS Includes Shell, other interface software & C compiler components(Compiler, assembler, loader) A process accesses system resources through system call. System call for  Process Control: - fork: create a new process - wait: allow a parent process to synchronize its execution with the exit of a child process. - exec: invoke a new program. - exit: terminate process execution  File system: - File: open, read, write, lseek, close - inode: chdir, chown chmod - others: mount, unmount, link, unlink

10 PROCESS CONTROL SUBSYSTEM Process Synchronization Interprocess communication Memory management: Scheduler : process scheduling (allocate CPU to Processes)

11 FILE SUBSYSTEM A file system is a collection of files and directories on a disk or tape in standard UNIX file system format. Kernel’s file subsystem regulates data flow between the kernel and secondary storage devices.

12 HARDWARE CONTROL Hardware control is responsible for handling interrupts and for communicating with the machine. Devices such as disks or terminals may interrupt the CPU while a process is executing. The kernel may resume execution of the interrupted process after servicing the interrupt.

13 Kernel Mode(Privileged Mode) Kernel mode, also referred to as system mode. two distinct modes of operation of the CPU in Linux o Kernel mode and user mode.  User mode - non-privileged mode for user programs.  Kernel Mode - Mainly for Restriction/ Protection from unauthorized user application program.

14 When the CPU is in kernel mode, it is assumed to be executing trusted software, and thus it can execute any instructions and reference any memory addresses (i.e., locations in memory). all other programs(user applications) are considered untrusted software. Thus, all user mode software must request use of the kernel by means of a system call in order to perform privileged instructions, such as process creation or input/output operations.

15 A good example of this would be device drivers. A device driver must tell the kernel exactly how to interact with a piece of hardware, so it must be run in kernel mode. Because of this close interaction with the kernel, the kernel is also a lot more vulnerable to programs running in this mode, so it becomes highly crucial that drivers are properly debugged before being released to the public.

16 It is a non-privileged mode in which each process (i.e., a running instance of a program) starts out. It is non-privileged in that it is forbidden for processes in this mode to access those portions of memory(i.e., RAM) that have been allocated to the kernel or to other programs. When a user mode process (i.e., a process currently in user mode) wants to use a service that is provided by the kernel (i.e., access system resources other than the limited memory space that is allocated to the user program), it must switch temporarily into kernel mode, which has root (i.e., administrative) privileges, including root access permissions (i.e., permission to access any memory space or other resources on the system). When the kernel has satisfied the process's request, it restores the process to user mode. The standard procedure to switch from user mode to kernel mode is to call the 0x80 software interrupt. User Mode

17 When do we switch? Once we understand that there are 2 different modes, we have to know when we switch from one to the other. Typically, there are 2 points of switching:  When calling a System Call: after calling a System Call, the task voluntary calls pieces of code living in Kernel Mode  When an IRQ (or exception) comes: after the IRQ an IRQ handler (or exception handler) is called, then control returns back to the task that was interrupted like nothing was happened. Switching from User Mode to Kernel Mode

18 WHAT IS SHELL? Shell is A user program provided for user interaction with OS A command language interpreter that executes commands read from the standard input device such as keyboard or from a file Starts when you log in or open a console(terminal) Every UNIX system has atleast one shell. A shell is a program that sits on the kernel and acts as an agent or interface between the users and the kernel, similar to command.com in the MS-DOS environment Command interpreters ($ or %) Create customized environments Write shell scripts Define command aliases Manipulate command history

19  To check shell: echo $SHELL (shell is a pre-defined variable)  To switch shell: exec shellname (e.g., % exec bash)

20 FEATURES OF SHELL Interactive Environment:  a dialogue (communication channel) between the user and the host Unix system.  This dialogue lasts / terminate when the user ends the session. Shell scripts:  It is the shell that has the facility to be ‘programmed’.  contains internal commands  Shell scripts are groups of unix commands.  shell is itself a program. Input /Output redirection:  redirects the output from program to a destination other than your screen.  you can save the output from a command into a file and redirect it to a printer, another terminal on the network or even another program.  Similarly, the input from other than the keyboard can also be accepted by redirecting input from another source.

21 Piping Mechanism:  the output of one command to be used as input in another Unix command. E.g. who | wc Metacharacter facilities / filename substitution:  Shells recognize the *,? or [..] as special characters when reading the arguments to a command line.  E.g. ls s* --- it display all files begins with ‘s’ Background processing:  Multi-tasking facilities allows the user to run command in the background.  This allows the command to be processed while the user can proceed with other tasks.  When a background task is completed, the user is notified.

22 Customized Environment: - The shell is your working environment. Facilities are available by which the shell can be customized for your personal needs. Programming Language Constructs: - The shell includes features that allow it to be used as programming language. These features can be used to build shell scripts that perform complex operations. Shell variables: - The user can control the behavior of the shell, as well as other programs and utilities, by storing data in variables.


Download ppt "WHY AN OPERATING SYSTEM (OS) OS interacts with hardware and manages programs. Programs not expected to know which hardware they will run on. Must be possible."

Similar presentations


Ads by Google