Sie sind auf Seite 1von 16

Linux Architecture

Agenda

• Monolithic and Micro Kernel Architectures


• Linux Architecture
• Features of Linux
• Sample user space and kernel space
programs
• Files and File Types
• File Permissions, Users and Attributes
• File System Layout
Monolithic OS
Micro Kernel OS
Layered Architecture of Linux

USER APPLICATIONS

STANDARD LIBRARY

SYSTEM CALL LIBRARY


USER MODE
KERNEL MODE

KERNEL

DEVICE DRIVERS

HARDWARE

Layered Architecture of Linux


Linux Architecture
Invoking a System Call
Split View

KERNEL

S
O
F
T KERNEL I/O SUBSYSTEM
W
A
R
Mouse Device Keyboard Device PCI Bus Device Floppy Device
E
Driver Driver Driver
…… Driver

Mouse Device Keyboard PCI Bus Device Floppy Device


Controller Device Controller
… Controller
H
A Controller
R
D
W
A
R
E Mouse Keyboard PCI Bus
… Floppy

Split View of Kernel I/O SubSystem with Device Drivers


Features of Linux
• Unix like Operating System
• Monolithic
• Dynamic Kernel modules
• Preemptive multitasking
• Virtual Memory
• Shared Libraries
• Shared Copy-on-write executables
• SMP support
• TCP/IP support
• Open Source
Application using Standard Library
Interface

#include <stdio.h>
int main()
{
printf(“Hello World\n”);
return(0);
}
Application using System Call
Library Interface

#include <unistd.h>
int main()
{
write(1,”Hello World\n”, 12);
return(0);
}
Kernel Module
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>

// Initialization Function
int init_module(void)
{
printk(“Hello World Init\n”);
return(0);
}

//Cleanup Function
void cleanup_module(void)
{
printk(“Hello World cleanup\n”);
}
Files

• Everything is a file or a process


• A file is a linear stream of bytes
• Unification of File I/O and Device I/O
• File Types
 Regular -
 Directory d
 Link l
 Character Device c
 Block Device b
Socket s
Named Pipe p
Files
• File Permissions
– Read (r )
– Write (w )
– Execute (x)
• User Categories
-user
-group
-other
• File Attributes
-rw-rw-r-- 1 raju sec 31744 Feb 21 17:56 intro.txt
File System Layout

• / Begins file system structure, called the root


• /home Users home directories
• /bin Standard commands and utility programs
• /usr Files and commands used by system
• /usr/lib Host libraries for programming languages
• /dev Holds file interfaces for devices
• /etc Holds system configuration files
• /var Storage for all variable files and temporary files
• /root The administrative user's home directory
• /sbin Programs for use by the system and the system
administrator.
Thank You

Das könnte Ihnen auch gefallen