38
Operating systems introduction Operating systems I800 Edmund Laugasson [email protected] Current document copying, distributing and/or modifying has been set out by one of the following licences by user’s choice: * GNU Free Documentation Licence version 1.2 or newer * Creative Commonsi Attribution + ShareAlike licence 4.0 (CC BY-SA) There has been used materials from Margus Ernits, Katrin Loodus when creating current slides.

Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

  • Upload
    lethien

  • View
    220

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

Operating systems introductionOperating systems I800

Edmund [email protected]

Current document copying, distributing and/or modifying has been set out by one of the following licences by user’s choice:* GNU Free Documentation Licence version 1.2 or newer* Creative Commonsi Attribution + ShareAlike licence 4.0 (CC BY-SA)

There has been used materials from Margus Ernits, Katrin Loodus when creating current slides.

Page 2: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

2 / 38

Q/AHow many operating systems do you have

in your pocket right now?

Page 3: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

3 / 38

Computer system

Operating System

User

Application

Hardware

Operating system is a vital component of the computer system

Page 4: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

4 / 38

Page 5: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

5 / 38

Definition of an OS

● An operating system (OS) is system software that manages computer hardware and software resources and provides common services for computer programs (API).

Page 6: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

6 / 38

In the beginning...

● There were no operating systems

– Apps were directly connected to devices and transition to another device was complicated

– Specific purpose only

● Problems

– Usage limitations

– Migration and integration were limited and capacious

– When needed to serve multiple programs or users then separate program were needed in order to keep an account

Page 7: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

7 / 38

… and now● There are operating systems everywhere

● Operating systems are working in small devices and also in cloud computing server rooms

● By equipment manufacturers are easier to use OS that fits onto device rather than create everything yourself again

● Security is much more important than earlier

● Modern OS offers solutions:

– Multiuser multitasking OS

– Application migration possible

– User permissions applied

– Better usage of resources

Page 8: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

8 / 38

Types of OS

● Single mode

● Single mode and multitasking

● Multiuser mode and multitasking

● Real time

– Robots, rockets

● Embedded

– Smart devices

● Distributed

– Servers

Page 9: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

9 / 38

Operating system's tasks● Hardware management

– CPU time– Memory management– Input/output management– Network management

● Computer system management

– Application management– Input/output device management– User authentication and authorization– Data management between devices (also over network)

Page 10: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

10 / 38

Command line interpretator● CLI – Command Line Interface or command line interpretator

– Bash shell, Bourne shell, cmd, PowerShell, zsh etc

– sysadmin should know:● how to enter commands● redirect one command output into second command input● redirect or take input, output from file or another program● program and automate activities

Page 11: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

11 / 38

Operating system's kernel

● Applications use the kernel to connect to computer system resources (CPU; memory and devices)

CPU(s)

Kernel

Applications

DevicesMemory

Page 12: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

12 / 38

OS helpers -> managers

Operating system is the head of operations with 4 managers

Page 13: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

13 / 38

Kernel tasks

● CPU time planning

– Real time vs Package processing– Syncing– Multitasking with multiple CPUs

● Memory management

– MMU - memory management unit– Cache and swap

● I/O management

– Syncronous– Asyncronous

● File management

– Permissions– File system hierarchy

Page 14: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

14 / 38

CPU time planning

● CPU time needs to be planned while:

– CPU usage efficiency – Reduce latency – Multitasking usage

● Algorithms for CPU time planning

– FCFS First Come First Served– SJF Shortest Job First– Priorities for processes

● Aim is to avoid starving– Round Robin

Page 15: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

15 / 38

CPU interrupts

● Interrupts are central to operating systems, as they provide an efficient way for the operating system to interact with and react to its environment

● Interrupts are triggered by:

– Hardware device

– Software application

– Timer and time planning

Page 16: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

16 / 38

OS components● kernel – mandatory

● user interface – optional

– CLI command line interface

– GUI graphical user interface

Page 17: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

17 / 38

Simplified Linux kernel scheme

video: How Linux is built?https://www.youtube.com/watch?v=yVpbFMhOAwE

http://www.ibm.com/developerworks/linux/library/l-linux-kernel/figure2.jpghttp://www.ibm.com/developerworks/linux/library/l-linux-kernel/

Page 18: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

18 / 38

Linux kernel in more detail● https://en.wikipedia.org/wiki/Scheduling_(computing)

on next slide: Linux kernel even more in detail

Page 19: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

19 / 38

Page 20: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

20 / 38

Kernel's supervisory and protected modes

● 0 – OS

● 1 – 2 - devices

● 3 – applications

http://en.wikipedia.org/wiki/File:Priv_rings.svg

What for are such division of modes?

Page 21: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

21 / 38

Memory manager (1)

● Virtual vs physical memory

● OS protects the memory

● Every process sees the allocated memory as interrupted virtual memory when at the same time MMU and OS convert it into the physical memory address

http://en.wikipedia.org/wiki/File:Virtual_memory.svg

Page 22: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

22 / 38

Memory manager (2)

● Every process is handed virtual memory by the OS

● Virtual address is translated into a physical memory address by the MMU

● Swapping

– Memory page is read into RAM only when asked

– Memory pages not in use may be swamped out

– Frees up RAM to disk

– Slower

● Disk cache – most of the free cache is used for data buffering

Page 23: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

23 / 38

Cache

● Cache is used to increase the performance of the whole system

● Processor cache

● Disk cache

What is the difference between cache and buffer?

Page 24: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

24 / 38

Cache vs buffer● cache – software or hardware component, which holds the data

for re-use them promptly. Reading data from cache is faster than the source data reading from random access memory (RAM) or a hard disk.

● (data) buffer – part of RAM for temporary data storage, which allows temporary recording through the exchange of data between two different transmission parameters of the unit. Most of the job is to maintain the buffer data to the processor to be processed prior to a device (such as a printer or hard drive) is sent.

Page 25: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

25 / 38

Cache vs buffer 2

● If you are working on the text in a document processor, then it is stored in the office document software buffer and only then, if you give the Save command, the data will be sent from the software buffer to disk (storage medium).

● the data is deemed to central processor cache from main computer memory, disk caching data comes from the hard disk, the web browser cache comes from web, etc.

● Buffer– is something that has to be written to the disk (etc block device)– keeps metadata (permissions, location etc)– tracks which device memory is read/written

● Cache– is something that has to be read from disk and store for later use– keeps real file content

Page 26: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

26 / 38

Device manager I/O

● Synchronous

– Data is written to disk or storage and the application will continue its work

– More reliable

● Asynchronous

– Data is sent to the operating system (cache) and the application continues its work

– Data is written to disk or storage

– Less reliable

Page 27: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

27 / 38

Partitions and file system● MBR (DOS) type partition table can have:

– 4 primary partitions, e.g. /dev/sdx1...4 (replace “x” with a...z)– 3 primary (/dev/sdx1...3) + 1 extended (/dev/sdx4) with 1….128

logical volumes (/dev/sdx5...132)

● GPT type partition table can have 1...128 partitions

● Keeps the files in a structure– File System Hierarchy– https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard

● Keeps a registry of every file

● Grants or revokes file permissions– Additional security with multiuser systems

● VFS – virtual file system – the software layer on top of a real file system, which allows different file systems appear as one unit for applications

Page 28: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

28 / 38

Virtual file system

Applications (processes)

VFS

Request-based device mapper targets

dm-multipath

Physical devices

HDD SSD DVD drive

Micron PCIe card

LSI RAID

Adaptec RAID

Qlogic HBA

Emulex HBA

malloc

BIOs (block I/Os)

sysfs (transport attributes) SCSI upper level drivers

/dev/sda

scsi-mq

.../dev/sd*

SCSI low level driversmegaraid_sas

aacraid

qla2xxx ...libata

ahci ata_piix ... lpfc

Transport classesscsi_transport_fc

scsi_transport_sas

scsi_transport_...

/dev/vd*

virtio_blk mtip32xx

/dev/rssd*

The Linux Storage Stack Diagram http://www.thomas-krenn.com/en/wiki/Linux_Storage_Stack_Diagram

Created by Werner Fischer and Georg Schönberger License: CC-BY-SA 3.0, see http://creativecommons.org/licenses/by-sa/3.0/

ext2 ext3

btrfs

ext4 xfs

ifs iso9660

...

NFS codaNetwork FS

gfs ocfs

smbfs ...

Pseudo FS Special purpose FSproc sysfs

futexfs

usbfs ...

tmpfs ramfs

devtmpfspipefs

network

nvme device

The Linux Storage Stack Diagram version 4.0, 2015-06-01

outlines the Linux storage stack as of Kernel version 4.0

mmap (anonymous pages)

iscsi_tcp

network

/dev/rbd*

Block-based FS

read

(2)

wri

te(2

)

open

(2)

stat

(2)

chm

od(2

)

...

Page cache

mdraid...

stackable

Devices on top of “normal” block devices drbd

(optional)

LVMBIOs (block I/Os)

BIOs BIOs

Block Layer

multi queue

blkmq

Software queues

Hardware dispatch queues

...

...

hooked in device drivers (they hook in like stacked devices do)

BIOs

Maps BIOs to requests

deadline

cfqnoop

I/O scheduler

Hardware dispatch queue

Request based drivers

BIO based drivers

Request based drivers

ceph

struct bio- sector on disk

- bio_vec cnt- bio_vec index- bio_vec list

- sector cnt

Fibr

e C

hann

el

over

Eth

erne

t

LIO

target_core_mod

tcm

_fc

Fire

Wir

e

ISC

SI

Direct I/O (O_DIRECT)

device mapper

network

iscs

i_ta

rget

_mod

sbp_

targ

et

target_core_file

target_core_iblock

target_core_pscsi

vfs_writev, vfs_readv, ...

dm-crypt dm-mirrordm-thindm-cache

tcm

_qla

2xxx

tcm

_usb

_gad

get

USB

Fibr

e C

hann

el

tcm

_vho

stVi

rtua

l Hos

t

/dev/nvme*n*

SCSI mid layer

virtio_pci

LSI 12Gbs SAS HBA

mpt3sas

bcache

/dev/nullb*

vmw_pvscsi

/dev/skd*

skd

stec device

virtio_scsi

para-virtualized SCSI

VMware's para-virtualized

SCSI

target_core_user

unionfs FUSE

/dev/mmcblk*p*

dm-raid

/dev/sr* /dev/st*

pm8001

PMC-Sierra HBA

SD-/MMC-Card

/dev/rsxx*

rsxx

IBM flash adapter

/dev/zram*

memory

null_blk

ufs

userspace

ecryptfs

Stackable FS

mobile device flash memory

nvme

overlayfs

userspace (e.g. sshfs)

mmcrbdzram

dm-delay

https://en.wikipedia.org/wiki/Virtual_file_system

Page 29: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

29 / 38

File systems● are different:

– may consider with file permissions

– can have different understanding of allowed file names

– may have with different limits and purposes

● e.g. EXT{2,3,4}, btrfs, NTFS, FAT{12,16,32}

● network file systems, distributed file systems

More reading:

● https://en.wikipedia.org/wiki/File_system

Page 31: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

31 / 38

System perfomance● computer performance shows the effectiveness of the computer system as a

whole, including the data processing capability; measured by benchmark; some of the indicators characterizing:– short response time– high throughput– low utilization of resources – high availaibility– fast (or high density) data compression– high bandwidth– short data transmission time– latency – delay of system and its various components between referral and

system response (check also access time)– MIPS – characterizing indicator of CPU, in Linux also BogoMIPS – file system perfomance, see Linux filesystem perfomance test, in case of NTFS

Page 32: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

32 / 38Security is important!

● 420 000 ID-card needs new certificate – needed to increase security

● Cyber Hedgehog 2015 – the largest cyber exercise in Estonian history – CONEX, Locked Shields, Cyber Coalition, Cyber Europe

● Ther probability to break SHA-1 is too large – Google, Microsoft, Mozilla consider it unsecure

● cyber security legal framework needs to be simplified - cyber security management is now more than ten legal act in Estonia

https://www.ria.ee/ee/kuberturvalisuse-kokkuvotted.html

statistics available only in Estonian

Page 33: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

33 / 38

Administrator● Administrator

– System administrator● system installation● system management● system backup/restore● monitoring system load and volumes● developing system architecture

– Application administrator● application, service specific management

(e.g. economical software)

Page 34: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

34 / 38

Systems management● system administrator often have to deal with

– conducting procurements

– monitoring and planning system requirements

– testing and documentation

– computer network installation and management

– simplifying the system

– automating activities

– the management of workplace computers (PC admin)

– integrating software applications

Page 35: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

35 / 38

Systems management 2● continuing...

– programming

– searching and choosing of new software applications

– supporting users

– resolving cyber security incidents

– increasing the perfomance

– continuous self development and research in new technologies

– communication!

Page 36: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

36 / 38

Q/A?

What is a Linux distribution?

https://en.wikipedia.org/wiki/Linux_distribution https://en.wikipedia.org/wiki/List_of_Linux_distributions

https://distrowatch.com/

Page 37: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

37 / 38

Questions?

Page 38: Operating systems I800 - enos.itcollege.eeenos.itcollege.ee/~edmund/osadmin/eng/OS-introduction/OS...how to enter commands ... – CLI command line interface ... Emulex HBA malloc

38 / 38

Thank you for your attention!