Date post: | 12-Jan-2016 |
Category: |
Documents |
Upload: | philomena-reeves |
View: | 227 times |
Download: | 2 times |
1
2INC0 Operating SystemsIntroduction to Linux
Joris Geurts
practical schedule
week 1:•introduction Linux•introduction C•practical
next weeks:•explanation assignment 1/2/3•practical
2
3
What is Linux?
4
characteristics
• developed in 1970'sby Ritchie and Thomson
• multi user• multi tasking
5
advantages
• different hardware: IBM, Mips, Intel, ARM• simple structure• elaborate software tooling• command interpreter: the SHELL• principles applied in a consequent way
6
disadvantages
• cryptic names, e.g.:cat filename
• cryptic syntax: \ / * $ " ' ` ~ e.g.: grep "*.$1" `pick *.c` | lpr
• many members of the family, and they differ(Debian, Red Hat, Ubuntu, OpenSuse, Fedora, etc.)
August 31, 2010
Joris Geurts7
Unix family tree
8
Some Unix characteristics
• ‘Everything is a file’– including screen, mouse, hard disk etc.
• All (system) commands are just applications– including login procedure, file and directory management,– large and powerful set of commands
• The central role of the shell (command interpreter)– typing rather than clicking
• Built-in management of different users– multi-tasking and multi-user
August 31, 2010
Joris Geurts9
Linux take-off
Linux family tree
10
August 31, 2010
Joris Geurts11
Linux distributions (600+)
kernel + libraries + software applications
Linux desktop environments
12
GNOMEGNOME
KDE
Unity
Using Linux: virtualization
• VMware• Linux Ubuntu image
13
commands in a shell
interaction with the OS, e.g.:•ls•date•whoami•cal
14
Joris Geurts15
Command summary• Commands (find out their functionality)
– ls – mkdir, cp, mv, which, chmod, echo, grep, pwd, cat, ps– man
• input/output redirect– ls > file – command1 | command2 | command3– cat /etc/passwd | sort | less– less /etc/passwd
• editors– kate, gedit, vi– (to be installed) emacs, joe, nano, eclipse
Joris Geurts16
Practical assignments (shell)• Startup and login to the system
– Username: student Password: student
• Create a directory in– Your home directory (/home/student/)
– The temporary directory (/tmp/)
– The root directory (/)
• Copy the password file to your home directory
• Search where the ls binary is located– Determine its owner and permissions
– Record this information in a file
• Do a tutorial• Install Dropbox (via Software Center)
17
C programming language
• Language of the Linux kernel and many of the applications
• Low-level– No memory protection
– No garbage collection
– No decent string type
– Direct memory pointer manipulation
• High execution performance possible– At the cost of a longer development time
Joris Geurts19
Hello World
• see http://www.fhict.nl/docent/downloads/2INC0/
• compile and run
$ gcc -o helloworld helloworld.c
$ ./helloworld
• printfint i = 73;
printf ("Hello World\n");
printf ("decimal display: %d\n", i);
printf ("hexadecimal display: %04x\n", i);
• debugger…
Joris Geurts20
Debugging with nemiver
• sudo apt-get install nemiver (only once; already done)
• gcc -g –Wall –o myapp myapp.c
• nemiver myapp &– set breakpoints– run, step, etc.– inspect variables
Joris Geurts21
Pointers in C
roughly said:•C pointer =Java reference•C struct =Java object with public variables, without methods
Practical: see the comments in helloworld.c for extra assignments