cs240 computer science ii introduction to unix based on “unix for programmers and users” by...

13
CS240 Computer Science II Introduction to Unix Based on “UNIX for Programmers and Users” by G.Class and K. Ables

Upload: phoebe-norman

Post on 28-Dec-2015

213 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: CS240 Computer Science II Introduction to Unix Based on “UNIX for Programmers and Users” by G.Class and K. Ables

CS240 Computer Science II

Introduction to

UnixBased on “UNIX for Programmers and Users” by G.Class and K. Ables

Page 2: CS240 Computer Science II Introduction to Unix Based on “UNIX for Programmers and Users” by G.Class and K. Ables

What is Unix

• Unix is an operating system

• An operating system controls and manages all hardware and software resources of a computer system; it also coordinates the operation of the entire computer system.

Page 3: CS240 Computer Science II Introduction to Unix Based on “UNIX for Programmers and Users” by G.Class and K. Ables

Hardware resources

• CPU• RAM, ROM• Disk, CD-ROM drive, tape• Monitor, printer• Graphics card• Keyboard, mouse• Modem• Ethernet interface• Other peripherals

Page 4: CS240 Computer Science II Introduction to Unix Based on “UNIX for Programmers and Users” by G.Class and K. Ables

Software resources

Unix provides services for the creation, modification, and destruction of programs, files, and processes.

• File: have a owner; stores in directory or subdirectory organized in a hierarchical or tree structure

• Program: an executable file• Process: a program that is running

– Most processes read data from and write data to files

Page 5: CS240 Computer Science II Introduction to Unix Based on “UNIX for Programmers and Users” by G.Class and K. Ables

A typical Unix Files System(Sun Microsystems Solaris)

Page 6: CS240 Computer Science II Introduction to Unix Based on “UNIX for Programmers and Users” by G.Class and K. Ables

Sharing Resources

• UNIX facilities sharing resources– CPU: through “time slicing” (typically 1/10

sec)– RAM: through “paging” to run concurrently

multiple processes– Disk space: by dividing disk space into

numerous equal-sized “blocks”; a file is stored on one or more blocks

Page 7: CS240 Computer Science II Introduction to Unix Based on “UNIX for Programmers and Users” by G.Class and K. Ables

Communication

Components of a computer system communication among themselves, e.g.,

• a process may talk to – A graphics card to display data– A keyboard to get input

• A mail system may talk to other computers to send/receive mail

• Two processes need to talk to each other in order to collaborate on a single problem (known as inter-process communication).

Page 8: CS240 Computer Science II Introduction to Unix Based on “UNIX for Programmers and Users” by G.Class and K. Ables

Inter-process Communication

Some typical inter-process Communication mechanisms

• Pipe: a one-way medium speed data channel that allows two processes on the same machine to talk.

• Socket: a two-way high-speed channel that allows two processes on different machines to talk.

Page 9: CS240 Computer Science II Introduction to Unix Based on “UNIX for Programmers and Users” by G.Class and K. Ables

Utilities

• Standard Unix comes with at least 200 utility programs including– Compilers

– Text processing tools

– Spreadsheets

– Desk-top publishing

– Sorting utility

– Some shells programs

– Graphical user interface (GUI)

Page 10: CS240 Computer Science II Introduction to Unix Based on “UNIX for Programmers and Users” by G.Class and K. Ables

Programmer Support

• Internal software architecture is well documented

• Source code is open and available from the internet free of charge

• Programming languages such as C/C++, and program development tools such as debugger are within the reach of programmers.

Page 11: CS240 Computer Science II Introduction to Unix Based on “UNIX for Programmers and Users” by G.Class and K. Ables

UNIX is Standardized

Two main versions• System V Unix: Solaris• BSD (Berkeley Standard Distribution): HP-

UX, AIX (IBM)

Both groups tried to comply with a set of standards set by POSIX (Portable Operating System Interface) committee.

Page 12: CS240 Computer Science II Introduction to Unix Based on “UNIX for Programmers and Users” by G.Class and K. Ables

Philosophies of UNIX

• Written in C, highly portable

• Lean and mean: original UNIX was based on a small number of utilities; each utility does one thing and does it well.

• Utilities can be easily combined through “pipes” to perform more complex tasks

Page 13: CS240 Computer Science II Introduction to Unix Based on “UNIX for Programmers and Users” by G.Class and K. Ables

Evolution of UNIX

• p11