C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses,...

23
C and Unix
  • date post

    22-Dec-2015
  • Category

    Documents

  • view

    219
  • download

    4

Transcript of C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses,...

Page 1: C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses, captains, baggage handlers, and ticket agents look the.

C and Unix

Page 2: C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses, captains, baggage handlers, and ticket agents look the.

Introduction to Different OS Airlines• 1. Mac Airline:

• All the stewards, stewardesses, captains, baggage handlers, and ticket agents look the same, act the same, and talk the same.

• Every time you ask questions about details, you are told you don't need to know, don't want to know, and that everything will be done for you without you having to know, so just shut up.

Page 3: C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses, captains, baggage handlers, and ticket agents look the.

• 2. OS/2 Airline: • To board the plane, you have your ticket

stamped ten different times by standing in ten different lines.

• Then you fill out a form showing where you want to sit and whether the plane should look and feel like an ocean liner, a passenger train, or a bus.

• If you succeed in getting on board the plane and the plane succeeds in getting off the ground, you have a wonderful trip... except for the times when the rudder and flaps get frozen in position, in which case you have time to say your prayers and get in crash position.

Page 4: C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses, captains, baggage handlers, and ticket agents look the.

Windows Airline • The airport terminal is nice and colorful,

with friendly stewards and stewardesses, easy access to the plane, and a completely uneventful takeoff...

• then, once in the air, the plane blows up without any warning whatsoever.

Page 5: C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses, captains, baggage handlers, and ticket agents look the.

Win NT Airline: • Everyone marches out on the runway,

says the password in unison, and forms the outline of an airplane.

• Then they all sit down and make a whooshing sound like they're flying.

Page 6: C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses, captains, baggage handlers, and ticket agents look the.

Unix Airline: • Everyone brings one piece of the plane

with them when they come to the airport.

• They all go out on the runway and put the plane together piece by piece, arguing constantly about what kind of plane they're building.

Page 7: C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses, captains, baggage handlers, and ticket agents look the.

Why Learn UNIX/LINUX?

• UNIX/LINUX plays a crucial role in academic and corporate computing.

• In fact, Unix/Linux powers more Internet servers and corporate networks than Microsoft Windows NT and 2000 combined.

Page 8: C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses, captains, baggage handlers, and ticket agents look the.

A Couple Basic Concept and Terms

• 1. File.

• 2. Process.

• 3. Memory

• 4. HD

Page 9: C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses, captains, baggage handlers, and ticket agents look the.

Binary Number

• Decimal

• Binary

• Octal

• Hexadecimal

• Logical Operations

• Arithmetic Operations

Page 10: C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses, captains, baggage handlers, and ticket agents look the.

Unix

• What is Unix?

• What is Operating System (OS)?

• Basic Computer components.

• The relationship between hardware and software.

• The roles of OS.

• The roles of C (programming language).

Page 11: C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses, captains, baggage handlers, and ticket agents look the.

Unix as an “open” system

• The internal software architecture is well defined and available in source code form, either free or for a relatively small fee.

• Another similar OS is Linux which is basically free.

Page 12: C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses, captains, baggage handlers, and ticket agents look the.

Unix Standards

• AT&T’s Bell Lab first invented and introduced the original Unix version (now becomes system V).

• Other versions:

• BSD—Berkeley Standard Distribution

• IBM—AIX

• HP– HP-UX

Page 13: C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses, captains, baggage handlers, and ticket agents look the.

Main Features of Unix

• 1. It is a multi-user system.• *** The most important concept—Time Sharing• 2. It shares CPUs, memory, disk space • efficiently.• 3. It has a large number of standard • utilities.• 4. It is a portable system that is available • for many different platforms.

Page 14: C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses, captains, baggage handlers, and ticket agents look the.

Using C with UNIX • A little knowledge is necessary before you can

write and compile programs on the UNIX system. Every programmer goes through the same three step cycle.

• 1. Writing the program into a file • 2. Compiling the program • 3. Running the program • During program development, the programmer

may repeat this cycle many times, refining, testing and debugging a program until a satisfactory result is achieved.

Page 15: C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses, captains, baggage handlers, and ticket agents look the.

• C and UNIX• This course teaches C under the UNIX operating

system.• C programs will look similar under any other

system (such as VMS or DOS), some other features will differ from system to system.

• In particular the method of compiling a program

to produce a file of runnable (executable) code will be different on each system.

• The UNIX system is itself written in C. In fact, C was invented specifically to implement UNIX.

• All of the UNIX commands which you type, plus the other system facilities such as password checking, line printer queues or magnetic tape controllers are written in C.

Page 16: C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses, captains, baggage handlers, and ticket agents look the.

• In the course of the development of UNIX, hundreds of functions were written to give access to various facets of the system. These functions are available to the programmer in libraries.

• By writing in C and using the UNIX system libraries, very powerful system programs can be created.

• These libraries are less easy to access using other programming languages.

• C is therefore the natural language for writing UNIX system programs.

Page 17: C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses, captains, baggage handlers, and ticket agents look the.

This Course

• One of the main objects for this course is to introduce programmers to the C language.

• Previous programming experience is assumed, so we can quickly progress to looking at the features of C and their uses.

• Students with little programming experience will need to do some more homework in order to keep up with the lectures.

Page 18: C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses, captains, baggage handlers, and ticket agents look the.

Common C

• Until recently there was one dominant form of the C language.

• This was the native UNIX form, which for historical reasons is known as either Bell Labs C, after the most popular compiler, or K. &R. C, after the authors of the most popular textbook on the language.

• It is now often called "Classic C"

Page 19: C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses, captains, baggage handlers, and ticket agents look the.

ANSI C • The American National Standards Institute defined a

standard for C, eliminating much uncertainty about the exact syntax of the language. This newcomer, called ANSI C, proclaims itself the standard version of the language. As such it will inevitably overtake, and eventually replace common C.

• ANSI C does incorporate a few improvements over the old common C. The main difference is in the grammar of the language. The form of function declarations has been changed making them rather more like Pascal (another used to be popular language) procedures.

• This course introduces ANSI C since it is supported by the SUN workstation compilers. Most C programming texts are now available in ANSI editions.

Page 20: C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses, captains, baggage handlers, and ticket agents look the.

.

• .

Unix File System

• Unix has three categories of files:

• 1. Regular Files

• which could be: code, data, text….

• 2. Directory Files

• 3. Special Files

• device files, such as: printers, disks,

• terminals…

Page 21: C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses, captains, baggage handlers, and ticket agents look the.

File and Directory Names

• Avoid using the following characters in any filenames:

• < >, ( ) , [ ], { }, *, ? , “ , ` , - , $, ^

• To avoid confusion, the following characters are recommended:

• ( A – Z ) , (a – z), ( 0 – 9) , ( _ ) , ( . )

• Be careful about using:

• Space --- Never use it in any part of Filename

Page 22: C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses, captains, baggage handlers, and ticket agents look the.

File Type and Access Mode

• When using ls –l command, one can see the full nature of files.

• The first character in each line indicate the file types:

• - indicates an ordinary file

• d indicates a directory file

• b indicates a block-orientated special file

• c indicates a character-oriented special file

Page 23: C and Unix. Introduction to Different OS Airlines 1. Mac Airline: All the stewards, stewardesses, captains, baggage handlers, and ticket agents look the.

The Unix/Linux Servers

• Server 1 – cslinux2.cs.semo.edu

• Sever 2 – linux2.semo.edu