Advanced Programming in the UNIX Environment Hop Lee.

Slides:



Advertisements
Similar presentations
C language was developed in early 1970s by Dennis Ritchie at Bell Laboratories to implement the UNIX operating system on the PDP-11 manufactured by DEC.
Advertisements

CSE 105 Structured Programming Language (C)
CS 497C – Introduction to UNIX Lecture 5: Understanding the UNIX Command Chin-Chih Chang
1 The C Language An International Standard CIS2450 Professional Aspect of Software Engineering.
879 CISC Parallel Computation High Performance Fortran (HPF) Ibrahim Halil Saruhan Although the [Fortran] group broke new ground …
Pemrograman C Risanuri Hidayat. Why C  Compact, fast, and powerful  “Mid-level” Language  Standard for program development (wide acceptance)  It is.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 4- 1 ; Programmer-Defined Functions Two components of a function definition.
C Programming Language 4 Developed in 1972 by Dennis Ritchie at AT&T Bell Laboratories 4 Used to rewrite the UNIX operating system 4 Widely used on UNIX.
CS 497C – Introduction to UNIX Lecture 2: Work with Files and Directories Chin-Chih Chang
Portability CPSC 315 – Programming Studio Spring 2008 Material from The Practice of Programming, by Pike and Kernighan.
C and Unix. A Couple Basic Concept and Terms 1. File. 2. Process. 3. Memory 4. HD.
Guide To UNIX Using Linux Third Edition
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 2: Operating-System Structures Modified from the text book.
Introduction To C++ Programming 1.0 Basic C++ Program Structure 2.0 Program Control 3.0 Array And Structures 4.0 Function 5.0 Pointer 6.0 Secure Programming.
Brief History of C and Unix Systems Programming Concepts.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
UNIX/Linux System Programming Jordan University of Science and Technology History.
POSIX: Files Introduction to Operating Systems: Discussion 1 Read Solaris System Interface Guide: Ch. 5.1 Basic File I/O.
“C” Programming Language CIS 218. Description C is a procedural languages designed to provide lowlevel access to computer system resources, provide language.
C: A VERY BRIEF HISTORY & STANDARDS © 1/4.
Chapter Seven Advanced Shell Programming. 2 Lesson A Developing a Fully Featured Program.
Windows Programming Lecture 05. Preprocessor Preprocessor Directives Preprocessor directives are instructions for compiler.
LINUX/UNIX WORKSTATIONS Franklin Montenegro Carlos Sierra.
Introduction to Unix Administration Objectives –to identify the basic concepts of Unix administration Contents –history of Unix –unix vendors and standards.
1 System Programming Chapters 1 & 2. 2 UNIX History Developed in the late 1960s and 1970s at Bell Labs UNICS – a pun MULTICS (Multiplexed Information.
UNIX OS By: Desmond Dagg Alannah Storm Mullins Carl Kavanagh Gareth Dunne Behzad Sanehi.
1 Computing Software. Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand.
Introduction of C++ language. C++ Predecessors Early high level languages or programming languages were written to address a particular kind of computing.
Advanced UNIX progamming Fall 2002 Instructor: Ashok Srinivasan Lecture 5 Acknowledgements: The syllabus and power point presentations are modified versions.
CSCI 130 Chapter 1. History of C Bell Telephone Laboratories (1972) Dennis Ritchie (also created UNIX) A - B - C.
UNIX and Shell Programming (06CS36) Unit 1 Continued… Shrinivas R. Mangalwede Department of Computer Science and Engineering K.L.S. Gogte Institute of.
Unix Background. Introducing Unix Brief Unix History u In 1969, Ken Thompson at AT&T Bell Labs began developing Unix. –First done in assembly language.
Introduction and Features of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++
LIS508 background of GNU/Linux
Chapter 2: Linux & POSIX “She sells bash shells by the C shore”
Operating System Part II: Introduction to the Unix Operating System (The Evolution of Unix)
Errors “Computer says no..”. Types of Errors Many different types of errors new ones are being invented every day by industrious programming students..
F PRESENTED BY YAN FENG F STUDENT ID: F Instructor: Professor Morteza Anvari F DATE: 03/17/2001.
History of UNIX a short version CSCI 333 August 31, 2011.
Computer Engineering Rabie A. Ramadan Lecture 5.
Computers & Operating Systems
Berkeley Software Distribution
UNIX and POSIX Standards
Introduction 1 Chapter 1. Introduction History and Proliferation Mandate for Change What’s Good and Wrong Scope of this course.
Basic UNIX Concepts. Why We Need an Operating System (OS) OS interacts with hardware and manages programs. A safe environment for programs to run is required.
Java Software Solutions Lewis and Loftus Chapter 9 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Enhanced Class Design -- Introduction.
Games: XML Presented by: Idham bin Mat Desa Mohd Sharizal bin Hamzah Mohd Radzuan bin Mohd Shaari Shukor bin Nordin.
Introduction to UNIX CS 2204 Class meeting 1 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 12 Separate Compilation and Namespaces.
Agenda UNX122_022_w1_p3 Overview of UNIX
C Part 1 Computer Organization I 1 August 2009 © McQuain, Feng & Ribbens A History Lesson Development of language by Dennis Ritchie at Bell.
Copyright © 2014 Pearson Addison-Wesley. All rights reserved. Chapter 2 C++ Basics.
Chapter 1: Preliminaries Lecture # 2. Chapter 1: Preliminaries Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation.
系統程式 System Programming 羅習五 國立中正大學資訊工程學系 Class: EA-001 (05) ext.
OPS224 Operating Systems - Unix Instructor: MURRAY SAUL.
© 2011 Pearson Education, publishing as Addison-Wesley Chapter 1: Computer Systems Presentation slides for Java Software Solutions for AP* Computer Science.
UNIX Operating System. A Brief Review of Computer System 1. The Hardware CPU, RAM, ROM, DISK, CD-ROM, Monitor, Graphics Card, Keyboard, Mouse, Printer,
Windows Programming Lecture 06. Data Types Classification Data types are classified in two categories that is, – those data types which stores decimal.
UDel CISC361 Study Operating System principles - processes, threads - scheduling - mutual exclusion - synchronization - deadlocks - memory management -
A LECTURE NOTE.
Unix Scripting Session 1 March 6, 2008.
Overview of UNIX.
Advanced UNIX progamming
Unix and Posix Standards
C Basics.
Introduction C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell.
Advanced UNIX progamming
Linux Professor Sabol.
UNIX and Shell Programming (06CS36)
UNIX and Shell Programming (06CS36)
Presentation transcript:

Advanced Programming in the UNIX Environment Hop Lee

Ch02 UNIX Standardization and Implementations UNIX Standardization UNIX Implementations Relationship of Standardization and Implementations Limits Conflicts Between Standards

§2.1 UNIX Standardization ANSI C POSIX.1 XPG3

ANSI C The intent of ANSI C standard is to provide portability of comforming C programs to a wide variety of operating systems, not just UNIX. This standard defines not only the syntax and semantics of the programming language but also a standard library. This library can be divided into 15 areas based on the headers defined by the standard.

IEEE POSIX POSIX is a family of standards developed by the IEEE. POSIX stands for Portable Operating System Interface. Include :the operating system interface, :shell and utilities, :system administration, etc. POSIX means IEEE Std , or ISO/IEC :1990.

X/Open XPG3 X/Open is an internation group of computer vendors. They have produced a seven volume portability guide named X/Open Portability Guide, Issue 3[X/Open 1989]. We'll call it XPG3. XPG3 is a super-set of POSIX.1 approximately.

FIPS FIPS stands for Federal Information Processing Standard, and these standards are published by the U.S. Government. FIPS 151-1(April 1989) is based on the IEEE Std and a draft of the ANSI C standard. FIPS requires some features that POSIX.1 lists as optional.

§2.1 UNIX Implementations The previous section described three standards are interface specifications. These standards are taken by vendors and turned into actual implementations. The ancestor of all implementations are Sixth Edition(1976) and Seventh Edition(1979) of the UNIX Time-Sharing System on PDP-11.

Three branches of the tree evolved: AT&T led to System III and System V(commercial versions); BSD led to the 4.xBSD implementations; AT&T Bell Laboratories led to the 8th, 9th, and 10th Editions(under continuing development).

System V Release 4 SVR4 is a product of AT&T UNIX System Laboratories. SVR4 conforms to both the POSIX standard and the X/Open XPG3 standard. AT&T also publishes the System V Interface Definition(SVID). Issue 3 of the SVID specifies the functionality that a UNIX system must offer to qualify as UNIX System V Release 4.

4.3+BSD The BSDs are produced and distributed by the Computer Systems Research Group at the University of California at Berkeley. Throughout this text we use the term 4.3+BSD to refer to the BSD system being described.

§2.3 Relationship of Standards and Implementations The standards that we've mentioned defined a subset of any actual system. The focus of this book is to describe two real UNIx systems: SVR4 and 4.3+BSD. Since both claim to be POSIX compliant we will also concentrate on the features that an implementations of these two systems.

§2.4 Limits There are many magic numbers and constants that are defined by the implementations. Three types of features are needed: compile-time options compile-time limits run-time limits The first two features can be defined in headers that any program can include at compile time. But run-time limits require the proecess to call a function to obtain the value of the limit.

Additinally, some limits can be fixed on a given implementation yet vary on another implementation. To solve the conflicts, three types of limits are provided: compile-time options and limits run-time limits that are not associated with a file or directory run-time limits that are associated with a file or directory

ANSI C Limits All the limits defined by ANSI C are compile- time limits. Check /usr/include/limits.h, /usr/include/linux/limits.h for the various limits and their values.

POSIX Limits POSIX.1 defines numerous constants that deal with implementation limits of the operating system. There are 33 different limits and constants. These are divided into the following eight categories: Invariant minimum values Invariant value: SSIZE_MAX Run-time increasable value: NGROUPS_MAS

Run-time invariant values (possible indeterminate): ARG_MAX, CHILD_MAX, OPEN_MAX, STREAM_MAX, and TZNAME_MAX Pathname variable values (possible indeterminate): LINK_MAX, MAX_CANON, MAX_INPUT, NAME_MAX, PATH_MAX, and PIPE_BUF Compile_time symbolic constants: _POSIX_SAVED_IDS, _POSIX_VERSION, and _POSIX_JOB_CONTROL

Execution-time symbolic constants: _POSIX_NO_TRUNC, _POSIX_VDISABLE, and _POSIX_CHOWN_RESTRICTED Obsolete constant: CLK_TCK Check /usr/include/bits/local_lim.h, /usr/include/bits/posix1_lim.h and /usr/include/bits/posix2_lim.h for the various limits and their values.

XPG3 Limits XPG3 defines seven constants that always appear in the header. POSIX.1 would call these invariant minimum values. XPG3 also defines the value PASS_MAX, which can appear in as the maximum number of significant characters in a password. POSIX.1 would call this value a run-time invariant value. The minimum acceptable value is 8.

sysconf, pathconf, and fpathconf Functions We've listed various minimum values that an implementation must support, but how do we find out the limits that a particular system actually supports? The run-time limits obtained by calling one of the following three functions: #include long sysconf(int name ); long pathconf(const char * pathname, int name ); long fpathconf(int fd, int name );

The parameters used by these three functions are restricted: Constants beginning with _SC_ are used by sysconf Constants beginning with _PC_ are used by either pathconf or fpathconf There are some restrictions for the pathname parameter to pathconf and the fd parameter to fpathconf. If any of those restriction aren't met, the results are undefined.

Example 2.1 Example 2.2