CS 149: Operating Systems January 27 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak www.cs.sjsu.edu/~mak.

Slides:



Advertisements
Similar presentations
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3: Operating Systems Computer Science: An Overview Tenth Edition.
Advertisements

Slide 2-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 2 Using the Operating System 2.
Chap 2 System Structures.
What’s the computer?? computer is an electronic device that stores, processes, inputs, and outputs data to produce a result.
1 Processes Professor Jennifer Rexford
1 Processes and Pipes COS 217 Professor Jennifer Rexford.
Chapter 1 Introduction
1 Introduction Chapter What is an operating system 1.2 History of operating systems 1.3 The operating system zoo 1.4 Computer hardware review 1.5.
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
Process in Unix, Linux and Windows CS-3013 C-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
CS-502 Fall 2006Processes in Unix, Linux, & Windows 1 Processes in Unix, Linux, and Windows CS502 Operating Systems.
Unix & Windows Processes 1 CS502 Spring 2006 Unix/Windows Processes.
Xuan Guo Chapter 1 What is UNIX? Graham Glass and King Ables, UNIX for Programmers and Users, Third Edition, Pearson Prentice Hall, 2003 Original Notes.
Processes in Unix, Linux, and Windows CS-502 Fall Processes in Unix, Linux, and Windows CS502 Operating Systems (Slides include materials from Operating.
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.
Installing Windows XP Professional Using Attended Installation Slide 1 of 41Session 2 Ver. 1.0 CompTIA A+ Certification: A Comprehensive Approach for all.
CS 235: User Interface Design January 22 Class Meeting
LECTURE 14 Operating Systems and Utility Programs
Process. Process Concept Process – a program in execution Textbook uses the terms job and process almost interchangeably A process includes: – program.
An Introduction to Operating Systems. Definition  An Operating System, or OS, is low-level software that enables a user and higher-level application.
Chapter 3  Manage the computer’s resources ◦ CPU ◦ Memory ◦ Disk drives ◦ Printers  Establish a user interface  Execute and provide services for applications.
Chapter 3 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.
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.
Guide to Linux Installation and Administration, 2e1 Chapter 3 Installing Linux.
NUMOSS NURUL ‘IZZATI BINTI OTHMAN A
CS 149: Operating Systems January 22 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
Hands-On Virtual Computing
Process in Unix, Linux, and Windows CS-3013 A-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
CS 149: Operating Systems January 29 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
CSC 322 Operating Systems Concepts Lecture - 4: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 14, 2005 Operating System.
Introduction to Operating Systems Chapter 1. cs431 -cotter2 Lecture Objectives Understand the relationship between computing hardware, operating system,
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 2: Operating-System Structures Operating.
CS 149: Operating Systems April 14 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
Computing Fundamenatls CMSC 201 Computer Science I Penny Rheingans University of Maryland Baltimore County (with inspiration from previous 201 instructors.
Linux in a Virtual Environment Nagarajan Prabakar School of Computing and Information Sciences Florida International University.
Operating Systems TexPREP Summer Camp Computer Science.
Chapter 1 Introduction 1.1 What is an operating system
MODERN OPERATING SYSTEMS Chapter 1 Introduction Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 1 Introduction Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc.
INVITATION TO COMPUTER SCIENCE, JAVA VERSION, THIRD EDITION Chapter 6: An Introduction to System Software and Virtual Machines.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Processes CS 6560: Operating Systems Design. 2 Von Neuman Model Both text (program) and data reside in memory Execution cycle Fetch instruction Decode.
1 Lecture 6 Introduction to Process Management COP 3353 Introduction to UNIX.
Know your Operating System Thanks to Dina Sokol. An operating system is software (a computer program) that manages your computer.
CS 149: Operating Systems March 5 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
Chapter 1 Introduction  What is an operating system  History of operating systems  The operating system zoo  Computer hardware review  Operating system.
操作系统原理 OPERATING SYSTEM Chapter 1 Introduction 概 述.
CMPE 226 Database Systems April 19 Class Meeting Department of Computer Engineering San Jose State University Spring 2016 Instructor: Ron Mak
CSC227: Operating Systems
Operating Systems & System Software
File System Implementation
Introduction to Operating System (OS)
TexPREP Summer Camp Computer Science
Chapter 4 The Power behind the Power
Processes in Unix, Linux, and Windows
OPERATING SYSTEMS DESIGN AND IMPLEMENTATION Third Edition ANDREW S
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Processes in Unix, Linux, and Windows
CGS 3763 Operating Systems Concepts Spring 2013
Chapter 4 The Power behind the Power
Chapter 3: Processes.
Processes in Unix, Linux, and Windows
Chapter 2: Operating-System Structures
Processes in Unix and Windows
Software - Operating Systems
Chapter 2: Operating-System Structures
Presentation transcript:

CS 149: Operating Systems January 27 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak 2 Project Teams  Assignments will be done by small project teams.  Form your own teams of 3 or 4 members each.  Choose your team members wisely! Be sure you’ll be able to meet and communicate with each other and work together well. No moving from team to team.

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak Project Teams, cont’d  Each team member will receive the same score on each team assignment and team project.  Each team to by as soon as Your team name A list of team members and addresses  Subject: CS 149- n Team Team Name Where n is your section number (2, 3, or 8) Example: CS Team Super Coders 3

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak 4 VirtualBox (PC and Mac)  Challenging to set up, but very powerful. Free software from Oracle: Latest version is   Download the Debian ISO file. Debian Linux distro: Latest version is Download "small installation image" which is a.iso file. ISO: optical disk image: a.iso file

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak 5 VirtualBox (PC and Mac), cont’d  Load the Debian ISO file into VirtualBox to create a Debian virtual machine (VM). You can run multiple VMs simultaneously, each with a different operating system. Subject to your disk and memory limitations.  Also install VirtualBox “guest additions”  Allows you to mount a shared folder that is accessible by both the VM and the host machine. Demo

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak VirtualBox “Guest Additions”  The Debian installation appears already to have the features of the VirtualBox guest additions. Therefore, you might not need to do this installation step.  Drop down the VirtualBox “Devices” menu at the top of the virtual machine window. Select “Install Guest Additions CD image …” Read Chapter 4 Guest Additions of the VirtualBox User Manual. 6

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak Set Up a Shared Folder  Create a folder on your host OS (Windows or Mac OS X) to be the shared folder.  In the VirtualBox control window, open Settings for your Debian VM.  Select the Shared Folders tab and link your shared folder to the VM. 7

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak Access the Shared Folder  In your Debian VM, you should be able to see your shared folder in /media, such as /media/sf_Shared  However, you may not have access rights to its contents as a regular user.  Log in as super user and see what groups you’re currently in (my username is rmak ): 8 $ su Password: # groups rmak rmak : rmak cdrom floppy audio dip video plugdev scanner bluetooth netdev

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak Access the Shared Folder, cont’d  Add yourself to the VirtualBox group vboxsf :  Restart Debian. Then as a regular user, you should be able to access the contents of the shared folder. 9 # gpasswd –a rmak vboxsf

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak VirtualBox Help  Debian installation screenshots, by Prof. Teng Moh: all/ all/  YouTube video of an Ubuntu installation with guest additions, by Duy Nguyen: s&index=2&list=PLMhjbbkN7ahyejodIucz5h- mBruTctFS3 s&index=2&list=PLMhjbbkN7ahyejodIucz5h- mBruTctFS3 10

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak 11 Take roll!

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak 12 Abstractions  An operating systems provides abstractions of the computer system.  Abstractions are useful for computer users and for software developers.

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak 13 Abstractions, cont’d  CPU  multiple processes Process: A program that is running locally or remotely.  Physical memory  virtual memory Processes can simultaneously occupy more memory than is physically available.  Disk storage  files Don’t worry about allocating space on disk drives that are local or on a network server.

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak 14 Abstraction: Processes  A process is an executing program.  It uses memory resources (an address space).  It uses machine registers.  It can create (“spawn”) child processes and thereby create a process tree.  Processes may need to communicate with each other IPC = interprocess communication Operating Systems: Design and Implementation Tanenbaum & Woodhull (c) 2006 Prentice-Hall, Inc. All rights reserved

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak 15 Abstraction: Memory  Early operating systems + computer hardware support together enabled multiprogramming. Operating Systems: Design and Implementation Tanenbaum & Woodhull (c) 2006 Prentice-Hall, Inc. All rights reserved

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak 16 Abstraction: File Systems  An operating system provides users and programmers with a file system. A very high level abstract view of data stored on disks. Data files are named. Data files are stored hierarchically in directories (folders). Operating Systems: Design and Implementation Tanenbaum & Woodhull (c) 2006 Prentice-Hall, Inc. All rights reserved

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak 17 OS Concept: API  The application programming interface (API) allows programs to make system calls to the operating system.  Typical types of system calls: process management signaling file management file system management protection time management

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak 18 Example System Call: fork()  A process creates a child process by making a fork() system call. fork() makes an exact copy of the parent (calling) process’s address space for the child process. Therefore, the parent and child processes will each have a separate address space.  Both processes continue executing at the point of the fork() call, each within its address space.

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak 19 Example System Call: fork()  How does a process know whether it’s the parent or the child? Parent: fork() returns the process id (pid) of the child process that was just created. Child: fork() returns 0. _

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak 20 Example System Call: fork() #include main() { printf("Parent: Process started.\n"); printf("Parent: Forking a child.\n"); if (fork() != 0) { int status; printf("Parent: Waiting for child to complete.\n"); waitpid(-1, &status, 0); printf("Parent: Child has completed.\n"); printf("Parent: Terminating.\n"); } else { printf("Child: Process started.\n"); printf("Child: Start 10 second idle:"); int i; for (i = 10; i >= 0; i--) { printf("%3d", i); fflush(stdout); sleep(1); } printf(" done!\n"); printf("Child: Terminating.\n"); } } Executed by the parent. Executed by the child. The two processes fork at this point. Demo forktest.c

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak 21 Assignment #1: Debian Up and Running  Due Monday, February 2 at 11:59 PM.  Install VirtualBox and Debian. Ubuntu is also acceptable.  Edit, compile, and run the sample program forktest.c in your Debian VM.

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak 22 Assignment #1, cont’d  Each student makes a screenshot (JPEG or PNG) that clearly shows: A window on your desktop (Windows or Mac) running Debian in a Virtual Box VM. A Debian terminal window that displays:  Output from the command grep username /etc/passwd  Compilation of forktest.c  A run of forktest and the program output.

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak Assignment #1, cont’d  Name each JPEG or PNG file after your team name followed by the team member name. Example: SuperCoders-MaryJane.png  This is a team assignment. Each team turns in one assignment Each member of the team will get the same score. All the team members’ screen shots have to be good in order for the team to get a perfect score. 23

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak 24 Assignment #1, cont’d  the screenshots to: One message per team with members’ screen shots as attachments.  Subject line: CS 149- n Assignment #1 team name where n is the section number (2, 3, or 8) Example: CS Assignment #1 SuperCoders  Be sure to cc all members of your team.

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak Assignment #1, cont’d 25

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak 26 OS Concept: Mounted File Systems  “Mount” an external file system located on removable media such as a CD ROM. Graft the external file system onto the main file system hierarchy. Operating Systems: Design and Implementation Tanenbaum & Woodhull (c) 2006 Prentice-Hall, Inc. All rights reserved Before mounting, the files on the floppy disk are not accessible. After mounting, the files are part of the file hierarchy.

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak 27 OS Concept: Pipes  Pipes are a mechanism for interprocess communication (IPC). One process writes to one end of a pipe. Another process reads from the other end. Each process believes it is doing file I/O. Operating Systems: Design and Implementation Tanenbaum & Woodhull (c) 2006 Prentice-Hall, Inc. All rights reserved

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak 28 OS Concept: Shell  The “shell” is the command-line interpreter that allows you to type commands to the operating system. Run application programs and system utilities. “Redirect” a program’s input and output. Run multiple programs and “pipe” one program’s output to another program as the latter’s input.  Graphical user interfaces (GUIs) also allow you to communicate with the operating system. Often the GUI issues shell commands. Windows, Mac OS, etc.

Computer Science Dept. Spring 2015: January 27 CS 149: Operating Systems © R. Mak 29 Shell: I/O Redirection  For a program run on the command line: Standard input (stdin) is the keyboard. Standard output (stdout) is the terminal. #include #define MAX_LENGTH 256 main(int argc, char *args[]) { char *progname = args[0]; char line[MAX_LENGTH]; while (gets(line) != NULL) { printf("%s: %s\n", progname+2, line); } } This program reads lines of text from stdin and echos them to stdout after prepending each line with the program name. Demo echo.c Why the +2 ?