COSC 350 System Programming

Slides:



Advertisements
Similar presentations
COMP5102/5122 Lecture 1 Operating Systems (OS) Introduction phones off (please)
Advertisements

Operating Systems Review. User Computer, including HW and SW.
Operating Systems - Introduction S H Srinivasan
Systems Programming Course Gustavo Rodriguez-Rivera.
Cs238 Lecture 3 Operating System Structures Dr. Alan R. Davis.
Silberschatz, Galvin and Gagne  Operating System Concepts Common OS Components Process Management Memory Management File Management I/O System.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 2: Operating-System Structures Modified from the text book.
Systems Software Operating Systems.
Unix Presentation. What is an Operating System An operating system (OS) is a program that allows you to interact with the computer -- all of the software.
The University of Akron Summit College Business Technology Department Computer Information Systems 2440: 145 Operating Systems Introduction to UNIX/Linux.
 Introduction Introduction  Definition of Operating System Definition of Operating System  Abstract View of OperatingSystem Abstract View of OperatingSystem.
Chapter 10 – UNIX. History In late 1960s, two employees of Bell Labs (Ken Thompson & Dennis Ritchie) designed a new operating system to overcome the constraints.
CS110/CS119 Introduction to Computing (Java)
Overview of Linux CS3530 Spring 2014 Dr. José M. Garrido Department of Computer Science.
CS240 Computer Science II Introduction to Unix Based on “UNIX for Programmers and Users” by G.Class and K. Ables.
OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements.
COSC513 Project Linux Features Instructor: Prof. Mort Anvari Student: Yingfeng Luo ID: #
ICOM Noack Operating Systems - Administrivia Prontuario - Please time-share and ask questions Info is in my homepage amadeus/~noack/ Make bookmark.
Introduction to Interactive Media Interactive Media Tools: Software.
CS 390 Unix Programming Summer Unix Programming - CS 3902 Course Details Online Information Please check.
CS 390 Unix Programming Environment Summer Suchindra Rengan - CS3902 Course Details Instructors Suchindra Rengan – ‘sachin’ ( Section 001)
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.
Systems Software Operating Systems. What is software? Software is the term that we use for all the programs and data that we use with a computer system.
Agenda Getting Started: Using Unix Unix Structure / Features Elements of the Unix Philosophy Unix Command Structure Command Line Editing Online Unix Command.
Operating System What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer hardware. An operating.
C Language: Introduction
Just Enough Unix, Chapter 1
OS, , Part I Operating - System Structures Department of Computer Engineering, PSUWannarat Suntiamorntut.
CS2204: Introduction to Unix January 19 th, 2004 Class Meeting 1 * Notes adapted by Christian Allgood from previous work by other members of the CS faculty.
Computer Software Types Three layers of software Operation.
UNIX Unit 1- Architecture of Unix - By Pratima.
A. Frank - P. Weisberg Operating Systems Structure of Operating Systems.
CSCI 330 UNIX and Network Programming Unit I Introduction.
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.
Chapter 9: Networking with Unix and Linux. Objectives: Describe the origins and history of the UNIX operating system Identify similarities and differences.
Introduction to UNIX CS 2204 Class meeting 1 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
Introduction to UNIX CS465. What is UNIX? (1) UNIX is an Operating System (OS). An operating system is a control program that allocates the computer's.
Chapter 1 Basic Concepts of Operating Systems Introduction Software A program is a sequence of instructions that enables the computer to carry.
Linux A practical introduction. 1)Background and Getting Started Linux is an operating system with multiple providers Red Hat/CentOS (our version) Ubuntu.
BIF713 Introduction to Linux. Agenda Getting Started: Using Linux Unix and Linux - Structure / Features Elements of the Linux Philosophy Linux Command.
A Mini UNIX Tutorial. What’s UNIX?  An operating system run on many servers/workstations  Invented by AT&T Bell Labs in late 60’s  There are many different.
CEG 2400 FALL 2012 Linux/UNIX Network Operating Systems.
WHY AN OPERATING SYSTEM (OS) OS interacts with hardware and manages programs. Programs not expected to know which hardware they will run on. Must be possible.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Operating System Structure Lecture: - Operating System Concepts Lecturer: - Pooja Sharma Computer Science Department, Punjabi University, Patiala.
Linux & UNIX OS Overview Fort Collins, CO Copyright © XTR Systems, LLC Overview of the Linux & UNIX Operating Systems Instructor: Joseph DiVerdi, Ph.D.,
Introduction to Operating Systems Concepts
By Jonathan Rinfret UNIX/LINUX By Jonathan Rinfret
Overview of Linux Fall 2016 Dr. Donghyun Kim
A LECTURE NOTE.
EE516: Embedded Software Project 1
Linking & Loading.
Software Tools Recitation 1
Introduction to Operating System (OS)
Structure of Unix OS.
Computer Science I CSC 135.
CSE 390a Lecture 1 introduction to Linux/Unix environment
Chapter 2: System Structures
Unix : Introduction and Commands
CSE 303 Lecture 1 introduction to Linux/Unix environment
Operating Systems Lecture 4.
Chapter 2: The Linux System Part 1
CSE 390a Lecture 1 introduction to Linux/Unix environment
Chapter 2: Operating-System Structures
Introduction to Operating Systems
Outline Chapter 2 (cont) OS Design OS structure
introduction to Linux/Unix environment
Chapter 1 What is UNIX? Graham Glass and King Ables,
Instructor: Xiuwen Liu Department of Computer Science
Chapter 2: Operating-System Structures
Presentation transcript:

COSC 350 System Programming Dr. Xiaohong (Sophie) Wang Department of Mathematics & Computer Science Email: xswang@salisbury.edu Office: HS122 Phone: (410) 677 5380

Course Outline UNIX/Linux basics & programming in Linux Working with files Terminals Processes IPC with signals and pipes Socket programming Perl programming (time permit)

Course Syllabus http://faculty.salisbury.edu/~xswang/ Courses/Csc350/cosc350.htm

0. Introduction Two kinds of computer software: System programs: manage the operation of the computer itself (operating systems, device drivers, etc) Application programs: solve problems for the computer users (compilers, editors, word processors)

What is Operating System? System program that controls all the computer’s resources and provides the base on which the application programs can be written. As an extended machines Present user with the equivalent of an extended machine that is easier to program than the underlying hardware As a resource manager Keep track of who is using which resource, to grant resource, to account for usage, and to mediate conflicting requests from different programs and users.

System calls A set of instructions provided by the operating system as the interface between the operating system and the user programs.

Kinds of system calls: File and directory management Process management Signaling Protection Time management

Organization of the OS GUI, Shell programming shell Kernel

Organization of the OS Kernel Shell Interacts with the hardware (know about devices, file structure, etc) Is built for a specific piece of hardware Has only a few user-level commands such as cp, mv, rm and file creation and manipulation Shell A program runs by the kernel Accepts user commands and presents them to the kernel Many varieties

Shell can work in Interactive mode Shell scripts Display prompt Read command Interpret command Execute command Shell scripts Write all shell commands into an executable file Run the executable file within the shell

History and Evolution of UNIX at Bell lab by Thompson & Ritchie in 1969 Two basic varieties: 4.3+BDS System V Release 4 Other vendors: IBM AIX Sun Solaris HP HP-UX SCO Unixware

Ideas behind UNIX Multi-users and multi-processes time slicing foreground and background Hierarchical directory structure (tree structure) Large number of small tools

UNIX Philosophy Simplicity Focus Reusable components Filters Open file format Flexibility

What is Linux? A freely distributed implementation of a UNIX-like kernel Low-level core of an operating system Similar to UNIX Initially developed by Linus Torvalds at University of Helsinki Developers from across the Internet

Programming Linux Linux programs (executables and scripts) The C compiler - gcc Library files Static libraries Shared libraries Getting help man page info

Libraries Collections of precompiled functions Standard system libraries are usually stored in /lib or /usr/lib A library file name starts with lib followed by what library this is (e.g., libc for c library, or libm for mathematical library) The last part of the name is .a for traditional, static libraries .so for shared libraries Compiler needs to be told which library to look for $gcc –o fred fred.c /usr/lib/libm.a $gcc –o fred fred.c –lm $gcc –o x11fred –L/usr/openwin/lib x11fred.c –lX11

Static libraries Collection of object files kept together To use those functions, include the header file The compiler and linker take care of combining the program code and library into a single executable -l is needed to indicate which libraries other than standard C library

Try it out - Static libraries Create source files #include <stdio.h> void fred(int arg) { printf("fred: you passed %d\n", arg); } void bill(char *arg) printf("bill: you passed %s\n", arg);

Compile those functions %gcc –c bill.c fred.c %ls *.o Header file for the library /* This is lib.h. It declares the functions fred and bill for users */ void bill(char *); void fred(int);

The calling program (program.c) #include "lib.h" int main() { bill("Hello World"); exit(0); } Compile the program %gcc –c program.c %gcc –o program program.o bill.o %./program Bill: you passed Hello World %

Create the library %ar crv libfoo.a bill.o fred.o a - bill.o a - fred.o Some systems (Berkeley UNIX) requires to create the table of content for the library (under Linux is not necessary) %ranlib libfoo.a To use the library %gcc –o program program.o –L. -lfoo

Shared libraries Problem with static library – many copies of the same function in the memory and disk space. When shared library is used, it is not included in the calling program. A reference to the library is made available to the calling program at run time. When the calling program is loaded for execution, the reference is resolved and calls made to the shared library, which is loaded into memory if needed. To see which shared libraries are required by a program $ldd program libc.so.6 => /lib/libc.so.6(0x4002a000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

Getting help On-line manual page On-line documentation system $man gcc $info gcc