Вы находитесь на странице: 1из 27

Operating Systems PS-1

Welcome

Can Kavaklolu 2014


Serdar Metin 2015

PS Topics
A brief history of OSs
What are we doing? Why?
Relation to Software Engineering
Command line familiarity
Experience in virtualization software
Some Linux experience
Minix 3

What is an operating system?

Multi user

Multi tasking

* http://en.wikipedia.org/wiki/Operating_system

Issues to address & appreciate


Division of labour
Establishing standards
Handling emergent problems
Adaptability (Use & Reuse)

Unix History
First publication in 1974 by AT&T Bell Labs
Design features:
o Can run on many different platforms
o Kernel provides minimum functionality, rest is left to
user programs

Around 1985
o Berkeley University's BSD Unix
o Bell Labs' System V Unix

1988 Sun Solaris OS by Sun


Microcomputers and AT&T
1989 POSIX.1 released by a Portable
Applications Standards Committee

Minix History
1987: First edition of Operating Systems
Design & Implementation released
o works on 256K 8088-based IBM PC with two
diskette drives and no hard disk
o Based on Unix Version 7

1997: Second edition released


o 32-bit support
o POSIX compatible
o Macintosh, Amiga, Atari, SPARC ports

2005: Minix 3 released


o 4000 lines of executable kernel code (not millions!)
o Drivers are in user space (except clock driver)

Linux History
1987 Minix implemented by Andrew S.
Tanenbaum for educational use (POSIX
compatible)
Linus Torvalds makes the historic post to the
MINIX news group 25 August 1991
GNU Project by Richard Stallman, started in
1983, GNU Operating System
o GNU's not Unix

The Post
From: torvalds@klaava.Helsinki.FI (Linus Benedict Torvalds)
Newsgroups: comp.os.minix
Subject: What would you like to see most in minix?
Summary: small poll for my new operating system
Message-ID: <1991Aug25.205708.9541@klaava.Helsinki.FI>
Date: 25 Aug 91 20:57:08 GMT
Organization: University of Helsinki
Hello everybody out there using minix I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486)
AT clones. This has been brewing since april, and is starting to get ready.I'd like any feedback on
things people like/dislike in minix, as my OS resembles it somewhat (same physical layout of the filesystem(due to practical reasons) among other things). I've currently ported bash(1.08) and
gcc(1.40),and things seem to work.This implies that I'll get something practical within a few months,
andI'd like to know what features most people would want. Any suggestions are welcome, but I won't
promise I'll implement them :-)
Linus (torvalds@kruuna.helsinki.fi)
PS. Yes - it's free of any minix code, and it has a multi-threaded fs. It is NOT protable (uses 386 task
switching etc), and it probably never will support anything other than AT-harddisks, as that's all I have
:-(.

Linux Today
Around 10,000 patches going into recent
kernel releases
Nearly 1000 developers representing over
100 corporations
Since 2005, over 3700 individual developers
from over 200 different companies have
contributed to the kernel
* http://www.linuxfoundation.org/publications/linuxkerneldevelopment.php

Linux Today

Human Computer Interaction

Human Computer Interaction

Accessing command line (Linux)


Two methods:
o Tty : Ctrl + Alt + [F1 F6]
(teletype, teletypewriter)
o X Window : Terminal emulator software
xterm - terminal emulator for X
gnome-terminal
kterm - multi-lingual terminal emulator for X

Concepts of Black Screen


Commands (thousands of them, 2535 on my
system)
Variables (env command)
Filesystem

Basic Commands
# echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/games
# pwd
/home/can
# cd /tmp/kek
(no output)
# ls -l
-rw-r--r-- 1 can2 can2 16 2008-10-07 22:28 kek
-rw-r--r-- 1 can2 can2 186 2008-10-07 22:39 kek.pl

Basic Commands
# touch hello; mkdir world
(no output)
# ls -al
drwxr-xr-x 2 can2 can2 4096 2008-10-09 15:53 .
drwxrwxrwt 29 root root 28672 2008-10-09 15:53 ..
-rw-r--r-- 1 can2 can2 0 2008-10-09 15:53 hello
drwxr-xr-x 2 can2 can2 4096 2008-10-09 15:54 world

Basic Commands
-rw-r--r-- 1 can2 can2 0 2008-10-09 15:53 hello
drwxr-xr-x 2 can2 can2 4096 2008-10-09 15:54 world

chown
chgrp
chmod

d : directory
- : file
s : socket
p : named pipe
l : symbolic link
c : character device
b : block device

Basic Commands
# cp source destination
# cp source... directory
# cp -r sourceDirectory destinationDirectory
# mv source destination
# mv source... directory
# rm file
# rm -r directory

Basic Commands
Disk usage (du)

du -sh .
12K .

du -sh *
0 hello
4.0K newfile4
4.0K world

du -sh -c *
0 hello
4.0K newfile
4.0K world
8.0K total

Basic Commands
df /
Filesystem 1K-blocks Used Available Use% Mounted
on
/dev/sda1 189682520 153591416 26455724 86% /

df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 181G 147G 26G 86% /

Basic Commands
crontab -l
# m h dom mon dow command
0 10 * * * nice -n 19 updatedb
crontab -e
@reboot @weekly
@yearly @midnight
@annually @hourly
@monthly @daily

Filesystem
Observe the tree: # ls /
bin boot dev etc home initrd lib lost+found media
mnt opt proc root sbin sys tmp usr var

Commands: mount / umount


# mount -o bind /proc/ /mnt/kek
mount: only root can do that
# su <password>
# mount -o bind /proc/ /mnt/kek

File viewing and manipulation


Commands : echo, cat, less, vim, emacs
Write into a file from command line:
echo hello world > /tmp/kek/newfile
Append to an existing file:
echo hello world again >> /tmp/kek/newfile
man bash
stderr, stdout
redirection

File viewing and manipulation


See contents of the file:
# cat /tmp/kek/newfile
hello world
hello world again
See contents of the file more conveniently
with scrolling and searching:
# less /tmp/kek/newfile

Complex file editor : vim


vim - Vi IMproved, a programmers text editor
Scroll with arrows
Edit mode [a] [i]
Normal mode [Esc]
Search with / word
Delete line dd
Yank line yy
Paste line p
set command :s/o//g100
Quit with :q Write with :w or both :wq

Cool file editor : emacs


Buffers
Multiple files side by side
Very extensible

Todo
Install latest Ubuntu
Install virtualbox package
Download minix3 latest stable release
(3.3.0)
Install minix3
Guide:
http://wiki.minix3.org/en/UsersGuide/Runnin
gMinixOnVirtualBox
Email any questions to email list
cmpe322@listeci.cmpe.boun.edu.tr