CSCI 1730 April 1 st, 2014. Materials Class notes slides & some “plain old” html & source code examples linked from course calendar board notes & diagrams.

Slides:



Advertisements
Similar presentations
Operating Systems Components of OS
Advertisements

Senem Kumova Metin Introduction to Programming CS 115 Introduction to Computing PART I : Computer Basics PART II: Introduction to Computing/Programming.
Lab 9 CIS 370 Umass Dartmouth.  A pipe is typically used as a one-way communications channel which couples one related process to another.  UNIX deals.
Chap 2 System Structures.
CS 497C – Introduction to UNIX Lecture 11: - The File System Chin-Chih Chang
UNIX chapter 07 Files and File System Structure
COSC 120 Computer Programming
11/13/01CS-550 Presentation - Overview of Microsoft disk operating system. 1 An Overview of Microsoft Disk Operating System.
CS 311 – Lecture 09 Outline Introduction to Systems programming – System calls – Categories of system calls Error Management System calls File Handling.
Linux+ Guide to Linux Certification, Second Edition
Operating Systems - Introduction S H Srinivasan
Operating Systems File systems
Guide To UNIX Using Linux Third Edition
Unix Shell Scripts. What are scripts ? Text files in certain format that are run by another program Examples: –Perl –Javascript –Shell scripts (we learn.
CIS 260 Computer Programming I in C Prof. Timothy Arndt.
Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access memory.
An Introduction to Operating Systems. Definition  An Operating System, or OS, is low-level software that enables a user and higher-level application.
CSCI 1730 March 27 th, Text System Programming with C and Unix by Hoover Ch 1: Introduction Ch 2: Bits, Bytes and Data Types Ch 3: Arrays and Strings.
Chapter 3.1:Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access.
Computer Systems Week 10: File Organisation Alma Whitfield.
Agenda  Terminal Handling in Unix File Descriptors Opening/Assigning & Closing Sockets Types of Sockets – Internal(Local) vs. Network(Internet) Programming.
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
Unix Primer. Unix Shell The shell is a command programming language that provides an interface to the UNIX operating system. The shell is a “regular”
Chapter 9 Part II Linux Command Line Access to Linux Authenticated login using a Linux account is required to access a Linux system. The Linux prompt will.
CS240 Computer Science II Introduction to Unix Based on “UNIX for Programmers and Users” by G.Class and K. Ables.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
RjpSystem Level Programming Operating Systems 1 Having fun withy the Unix Operating System Praxis Week 7 Rob Pooley.
An Introduction to UNIX System --- Cosc513 Presentation n Instructor: Morteza Anvari n Author: Yonghong Pan n ID#: n Date: Jan.29, 2001.
A Guide to Unix Using Linux Fourth Edition
Jozef Goetz, expanded by Jozef Goetz, 2009 Credits: Parts of the slides are based on slides created by UNIX textbook authors, Syed M. Sarwar, Robert.
CSC 322 Operating Systems Concepts Lecture - 4: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Overview: Linux and Unix Credit: Cailan Hao (Lancy) Instructor: Mort Anvari Date: 11/3/1999 Southeastern University (OS comparison) The symbol of Linux.
Linux overview. Architecture Kernel File system Shell: Korn, Bourne, C, Bash X Windows: Motif, Open Look, X.OrgX.Org Desktop: Gnome, KDE,etc.
CS 6560 Operating System Design Lecture 3:Tour of GNU/Linux.
System Administration Introduction to Unix Session 2 – Fri 02 Nov 2007 Reference:  chapter 1, The Unix Programming Environment, Kernighan & Pike, ISBN.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Operating-System Structures System Components Operating System Services.
Introduction to Bash Programming Ellen Zhang. Previous three classes What have we learnt so far ?
UNIX Commands. Why UNIX Commands Are Noninteractive Command may take input from the output of another command (filters). May be scheduled to run at specific.
1 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Some content in this lecture added.
Operating Systems David Goldschmidt, Ph.D. Computer Science The College of Saint Rose CIS 432.
Agenda Getting Started: Using Unix Unix Structure / Features Elements of the Unix Philosophy Unix Command Structure Command Line Editing Online Unix Command.
Introduction to Programming Using C An Introduction to Operating Systems.
UNIX Unit 1- Architecture of Unix - By Pratima.
Advanced Programming in the UNIX Environment Hop Lee.
Chapter 1 Computers, Compilers, & Unix. Overview u Computer hardware u Unix u Computer Languages u Compilers.
Linux Commands C151 Multi-User Operating Systems.
Slide: 1 UNIX FILE SYSTEM By:Qing Yang ID: Operating System Research Topic December, 2000.
UNIX & Windows NT Name: Jing Bai ID: Date:8/28/00.
CSC414 “Introduction to UNIX/ Linux” Lecture 2. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
CS 245 – Part 1 Using Operating Systems and Networks for Programmers Jiang Guo Dept. of Computer Science California State University Los Angeles.
Lecture 19 Linux/Unix – File System
A gentle introduction to LINUX at the command prompt.
UNIX filesystem CS 2204 Class meeting 2 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
BILKENT UNIVERSITY DEPARTMENT OF COMPUTER TECHNOLOGY AND INFORMATION SYSTEMS CTIS156 INFORMATION TECHNOLOGIES II FILES AND FILE SYSTEM STRUCTURE.
Privileges: who can control what
Avani R.Vasant V.V.P. Engineering College
File and File System Structure
Computer Organization & Assembly Language Chapter 3
UNIX System Overview.
INTRODUCTION TO UNIX: The Shell Command Interface
John Carelli, Instructor Kutztown University
An Introduction to UNIX System --- Cosc513 Presentation
OPERATING SYSTEMS DESIGN AND IMPLEMENTATION Third Edition ANDREW S
An overview of the kernel structure
Introduction Paul Flynn
UNIX File System Go Climb a Tree Weiyu Zhang (96142)
Lab 3: File Permissions.
January 26th, 2004 Class Meeting 2
Presentation transcript:

CSCI 1730 April 1 st, 2014

Materials Class notes slides & some “plain old” html & source code examples linked from course calendar board notes & diagrams Textbook (Hoover) Buy new / buy used / rent / eTextbook

Text System Programming with C and Unix by Hoover Ch 1: Introduction Ch 2: Bits, Bytes and Data Types Ch 3: Arrays and Strings Ch 4: Pointers and Structures Ch 5: Input/Output Ch 6: Program Management Ch 7: System Calls Ch 8: Libraries Ch 9: Scripting Languages

The UNIX operating system kernel + shell + system calls kernel: provides access to H/W resources of computer manages memory and CPU shell: provides command-line interface to services system calls: provide method-call interface to services

Overview of UNIX portion of course We'll (try to) cover: basic concepts and terminology files and directories processes interprocess communication signals and signal handling pipes shared memory, messages, semaphores X terminal i/o sockets standard i/o library

Basics: Files and Processes info stored in files while files have logical structure to programs that create and use them, at the UNIX level they are just a sequence of bytes no record terminators, no file terminators, no special file types names < 256 characters < 14 to be backward compatible

Directories, pathnames directories have hierarchical, tree-like structure each directory can contain files and subdirectories full names of UNIX files are pathnames, including directories /users/faculty/eileen/junk.txt /users Faculty eileen junk.txt … … …

Example /users/faculty/eileen/junk.txt (absolute pathname) if _current working directory_ is /users/faculty/eileen can use junk.txt (relative pathname) if _current working directory_ is /users/faculty can use eileen/junk.txt (also a relative pathname)

Ownership, permissions each file has an owner that owner is a member of a _group_ each file has 3 sets of permissions: read/write/execute one set for owner, one set for group, one set for public -rwxr-xr-x. 1 eileen users 50 Mar 31 20:29 play.exe -rw-r--r--. 1 eileen users 50 Mar 31 20:28 junk3.txt -rw-r eileen users 50 Mar 31 20:28 junk2.txt

Devices UNIX treats devices like files. filenames exist that represent devices like a keyboard or printer. To write to the printer, you can just write to the file that represents it... for example cat fileX > /dev/rmt0 causes the contents of fileX to be written to the tape drive associated with the rmt0 file in the /dev directory

Processes process = instance of an executing program When you type: > ls at the command line, the shell process creates a process to run the ls program. UNIX is multitasking more than one process can run at the same time i.e., multiple processes share the CPU

IPC: Interprocess Communication Consists of mechanisms that allow processes to send info to one another Methods differ in : type/amount of info number of processes whether processes need to exist at the same time whether processes need to be on the same machine

IPC: InterProcess Communication pipes output of one program is input of another signals processes that exist at same time on same machine can send integer signals shared memory processes that exist at same time can share variables semaphores control access to shared memory sockets processes that exist at the same time on same or different machines can communicate arbitrary info

The shell supports pipes: >ls | more output of the ls program is input to the more program >ls | grep notes | more output of the ls program is input to the grep program notes is a command line parameter to output of grep is input to more

System calls and library functions kernel memory resident program, deals with process scheduling and i/o control system calls the interface to the kernel and the resources it controls. invoked like library subroutines (but typically more efficient, lower level, run in 'kernel mode' rather than 'user mode'). Library routines are a layer between user code and system calls.

Common shell commands cd pwd set which

Common system commands grep ls man more time sort

C review – 4 data types /* A review of the basic data types in C. */ #include int main() { intx,y; chara; floatf,e; doubled; x=4; y=7; a='H'; f=-3.4; d= ; e= ; printf("%d %c %f %lf\n",x,a,e,d); printf("%d %c %.9f %.9lf\n",x,a,e,d); }

C review – arithmetic /* A review of the basic arithmetic operators in C. */ #include int main() { int x,y; int r1,r2,r3,r4,r5; x=4; y=7; r1=x+y; r2=x-y; r3=x/y; r4=x*y; printf("%d %d %d %d\n",r1,r2,r3,r4); r3++; r4--; r5=r4%r1; printf("%d %d %d\n",r3,r4,r5); }

C review – loops #include /* A review of the loop types in C. */ int main() { int i,x; x=0; for (i=0; i<4; i++) { x=x+i; printf("%d\n",x); } while (i<7) { x=x+i; i++; printf("%d\n",x); } do { x=x+i; i++; printf("%d\n",x); } while (i<9); }

C review – blocks /* A review of conditionals and blocks in C. */ #include int main() { int i,x; x=0; for (i=0; i<5; i++) { if (i%2 == 0 || i == 1) x=x+i; else x=x-i; printf("%d\n",x); }

C review – flow control /* A review of flow control statements in C. */ #include int main() { int i,x; x=0; for (i=0; i<5; i++) { if (i%2 == 0) continue; x=x-i; if (i%4 == 0) break; printf("%d\n",x); }

Chapter 2

ASCII /* This program shows the dual interpretations of char and ** unsigned char data types. */ #include main() { char a; unsigned char b; a='A'; b='B'; printf("%c %c %d %d\n",a,b,a,b); a=183; b=255; printf("%d %d\n",a,b); }

sizeof() operator /* This program demonstrates the sizeof() operator. */ #include main() { int i; char c; double d; printf("%d %d %d %d\n",sizeof(i),sizeof(c),sizeof(d),sizeof(float)); }

Bitwise NOT /* This program demonstrates the bitwise not operator. */ #include main() { unsigned char a; a=17; a=~a; printf("%d\n",a); }

Bitwise AND /* This program demonstrates the bitwise and operator. */ #include main() { unsigned char a,b; a=17; b=22; a=a & b; printf("%d\n",a); }

Bitwise OR /* This program demonstrates the bitwise or operator. */ #include main() { unsigned char a,b; a=17; b=22; a=a | b; printf("%d\n",a); }

Bit operators (variables and constants) /* This program demonstrates using the bitwise operators ** with variables and constants. */ #include main() { char x,y; x=7; y=6; x=x&y; y=x|16; printf("%d %d\n",x,y); }