+ All Categories
Home > Documents > 1 2INC0 Operating Systems Introduction to Linux Joris Geurts.

1 2INC0 Operating Systems Introduction to Linux Joris Geurts.

Date post: 12-Jan-2016
Category:
Upload: philomena-reeves
View: 227 times
Download: 2 times
Share this document with a friend
21
1 2INC0 Operating Systems Introduction to Linux Joris Geurts
Transcript
Page 1: 1 2INC0 Operating Systems Introduction to Linux Joris Geurts.

1

2INC0 Operating SystemsIntroduction to Linux

Joris Geurts

Page 2: 1 2INC0 Operating Systems Introduction to Linux Joris Geurts.

practical schedule

week 1:•introduction Linux•introduction C•practical

next weeks:•explanation assignment 1/2/3•practical

2

Page 3: 1 2INC0 Operating Systems Introduction to Linux Joris Geurts.

3

What is Linux?

Page 4: 1 2INC0 Operating Systems Introduction to Linux Joris Geurts.

4

characteristics

• developed in 1970'sby Ritchie and Thomson

• multi user• multi tasking

Page 5: 1 2INC0 Operating Systems Introduction to Linux Joris Geurts.

5

advantages

• different hardware: IBM, Mips, Intel, ARM• simple structure• elaborate software tooling• command interpreter: the SHELL• principles applied in a consequent way

Page 6: 1 2INC0 Operating Systems Introduction to Linux Joris Geurts.

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.)

Page 7: 1 2INC0 Operating Systems Introduction to Linux Joris Geurts.

August 31, 2010

Joris Geurts7

Unix family tree

Page 8: 1 2INC0 Operating Systems Introduction to Linux Joris Geurts.

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

Page 9: 1 2INC0 Operating Systems Introduction to Linux Joris Geurts.

August 31, 2010

Joris Geurts9

Linux take-off

Page 10: 1 2INC0 Operating Systems Introduction to Linux Joris Geurts.

Linux family tree

10

Page 11: 1 2INC0 Operating Systems Introduction to Linux Joris Geurts.

August 31, 2010

Joris Geurts11

Linux distributions (600+)

kernel + libraries + software applications

Page 12: 1 2INC0 Operating Systems Introduction to Linux Joris Geurts.

Linux desktop environments

12

GNOMEGNOME

KDE

Unity

Page 13: 1 2INC0 Operating Systems Introduction to Linux Joris Geurts.

Using Linux: virtualization

• VMware• Linux Ubuntu image

13

Page 14: 1 2INC0 Operating Systems Introduction to Linux Joris Geurts.

commands in a shell

interaction with the OS, e.g.:•ls•date•whoami•cal

14

Page 15: 1 2INC0 Operating Systems Introduction to Linux Joris Geurts.

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

Page 16: 1 2INC0 Operating Systems Introduction to Linux Joris Geurts.

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)

Page 17: 1 2INC0 Operating Systems Introduction to Linux Joris Geurts.

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

Page 18: 1 2INC0 Operating Systems Introduction to Linux Joris Geurts.

importance of C

18source: www.langpop.com

Page 19: 1 2INC0 Operating Systems Introduction to Linux Joris Geurts.

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…

Page 20: 1 2INC0 Operating Systems Introduction to Linux Joris Geurts.

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

Page 21: 1 2INC0 Operating Systems Introduction to Linux Joris Geurts.

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


Recommended