COMP 3000 2012 Week 3 Notes: Difference between revisions
proper mediawiki footnote reference |
Added second lecture |
||
Line 51: | Line 51: | ||
* windows comes from vms | * windows comes from vms | ||
** increment(vms) -> wnt | ** increment(vms) -> wnt | ||
== Init and Shell Scripts == | |||
Guest mini-lecture by Ann Fry | |||
* /etc/init.d/ | |||
* initialization scripts | |||
* examples | |||
** /etc/init.d/networking [start|stop] | |||
** /etc/init.d/networking [start|stop] | |||
* shell scripts | |||
* start with | |||
** #!/bin/bash | |||
** #!/bin/csh | |||
** #!/bin/ksh | |||
Ann passes the lecture to Anil Somayaji | |||
* Init scripts | |||
* Traditional init scripts run sequentially | |||
* Modern init scripts run in parallel | |||
* executables | |||
* ELF | |||
* A file starting with #! | |||
** next comes the path to an interpreter for the rest of the file | |||
* common directories | |||
* /etc | |||
** pronounced ett-see | |||
** configuration | |||
** different subdirectories | |||
** /etc/<prog>.conf | |||
** /etc/<prog>/[[User:Sdp|Sdp]] | |||
** /etc/<prog>.d/[[User:Sdp|Sdp]] | |||
* /bin | |||
** system binaries | |||
** often this is local | |||
* /lib | |||
** system libraries | |||
* /home | |||
** user directories | |||
* /usr | |||
** often this is shared | |||
** /usr/bin | |||
** user binaries | |||
** /usr/lib | |||
** user libraries | |||
== History of Unix == | |||
* In the beginning, there was AT&T's Unix | |||
* AT&T gave site licenses with all the source | |||
* Berkeley developed networking (at least TCP/IP) called BSD | |||
** licensed under permissive BSD license | |||
* AT&T forked System V | |||
** Not permissively licensed | |||
* Sun created hardware to run unix and forked SunOS from BSD | |||
* Sun changed from SunOS (BSD) to Solaris (System V) | |||
** people disliked this | |||
* POSIX standard was an outcome of the fragmentation | |||
* Free Software Foundation came out of the fragmentation | |||
** founded by rms (Richard M. Stallman) | |||
** not initially a very open development environment | |||
** built all the components of unix called GNU (GNU's Not Unix) | |||
** yacc -> bison | |||
** more -> less | |||
** cc -> gcc | |||
* Anil was sysadmin for a crystalography lab | |||
** SGI IRX boxes | |||
** ran IRIX | |||
* 80386 came out | |||
** capable of running a real unix because of virtual memory | |||
** legal status of BSD kernel became an issue because of lawsuit | |||
** GNU started Hurd | |||
** Linus Torvalds writes Linux kernel | |||
** uses GNU license | |||
** allowed everyone to make contributions | |||
* Eventually BSD legal stuff got figured out | |||
** 386BSD | |||
** FreeBSD | |||
** NetBSD | |||
*** OpenBSD | |||
* Anil's opinion | |||
* Linux has the best driver support of any OS including Windows | |||
== Back to Init == | |||
* Why do we care? | |||
* Unix is a culture | |||
* the culture shows up all over, like in /etc, /etc/init.d | |||
* Now there are 3 major replacements for system V init scripts | |||
* system V init scripts are just shell scripts run sequentially | |||
* it's desirable to run the initialization in parallel | |||
** oh noes, race conditions | |||
** init scripts have dependencies!! | |||
* init scripts were ordered by convention | |||
** had to figure out all the dependencies | |||
** still not completely figured out | |||
* everything on linux is an open source project | |||
* look around for a good project to document | |||
== References == | == References == | ||
{{note|vmlinux}}: https://en.wikipedia.org/wiki/Vmlinux | {{note|vmlinux}}: https://en.wikipedia.org/wiki/Vmlinux |
Revision as of 16:34, 24 September 2012
Shell
- useful command line programs
- bc -l
- command line calculator
- cal
- command line calendar
- uniq
- filters out duplicate lines
- sort
- takes input on STDIN, sorts lines, prints to STDOUT
- bc -l
- vmlinux is the linux kernel with virtual memory [vmlinux]
- vmlinuz is the same but compressed
- bash runs on vmlinux
- most programs run on bash
- ls/cd also run on vmlinux
- ls runs as a child process of bash
- to get rid of a misbehaving child
- the parent must kill it
- waits for child to die
- an unreaped child becomes a zombie
- zombies can't be killed, must be reaped
- to kill a zombie, must kill parent
- orphans become a child of init (ward of state)
- init is good at reaping children
job control
- job is a process
- term comes from batch processing
- Useful control sequences
- Ctrl-C
- terminate job
- Ctrl-Z
- stop job
- Ctrl-C
- To start a stopped job in the foreground
- fg %n
- where n is the job number
- fg %n
- To start a stopped job in the background
- bg %n
- To determine jobs that are running
- jobs
- Who manages jobs?
- the shell
- built on kernel functionality
Why we're studying unix
- all operating systems have basically the same architecture
- windows is just a variation on unix
- windows comes from vms
- increment(vms) -> wnt
Init and Shell Scripts
Guest mini-lecture by Ann Fry
- /etc/init.d/
- initialization scripts
- examples
- /etc/init.d/networking [start|stop]
- /etc/init.d/networking [start|stop]
- shell scripts
- start with
- #!/bin/bash
- #!/bin/csh
- #!/bin/ksh
Ann passes the lecture to Anil Somayaji
- Init scripts
- Traditional init scripts run sequentially
- Modern init scripts run in parallel
- executables
- ELF
- A file starting with #!
- next comes the path to an interpreter for the rest of the file
- common directories
- /etc
- /bin
- system binaries
- often this is local
- /lib
- system libraries
- /home
- user directories
- /usr
- often this is shared
- /usr/bin
- user binaries
- /usr/lib
- user libraries
History of Unix
- In the beginning, there was AT&T's Unix
- AT&T gave site licenses with all the source
- Berkeley developed networking (at least TCP/IP) called BSD
- licensed under permissive BSD license
- AT&T forked System V
- Not permissively licensed
- Sun created hardware to run unix and forked SunOS from BSD
- Sun changed from SunOS (BSD) to Solaris (System V)
- people disliked this
- POSIX standard was an outcome of the fragmentation
- Free Software Foundation came out of the fragmentation
- founded by rms (Richard M. Stallman)
- not initially a very open development environment
- built all the components of unix called GNU (GNU's Not Unix)
- yacc -> bison
- more -> less
- cc -> gcc
- Anil was sysadmin for a crystalography lab
- SGI IRX boxes
- ran IRIX
- 80386 came out
- capable of running a real unix because of virtual memory
- legal status of BSD kernel became an issue because of lawsuit
- GNU started Hurd
- Linus Torvalds writes Linux kernel
- uses GNU license
- allowed everyone to make contributions
- Eventually BSD legal stuff got figured out
- 386BSD
- FreeBSD
- NetBSD
- OpenBSD
- Anil's opinion
- Linux has the best driver support of any OS including Windows
Back to Init
- Why do we care?
- Unix is a culture
- the culture shows up all over, like in /etc, /etc/init.d
- Now there are 3 major replacements for system V init scripts
- system V init scripts are just shell scripts run sequentially
- it's desirable to run the initialization in parallel
- oh noes, race conditions
- init scripts have dependencies!!
- init scripts were ordered by convention
- had to figure out all the dependencies
- still not completely figured out
- everything on linux is an open source project
- look around for a good project to document