Project 1 Roadmap.

Slides:



Advertisements
Similar presentations
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Advertisements

1 CS345 Operating Systems Φροντιστήριο Άσκησης 1.
CSCC69: Operating Systems
Project 2 Roadmap. Segmentation Review Intel docs, fig. 3-1 and 3-5.
Day 11 Processes. Operating Systems Control Tables.
1 Processes and Pipes COS 217 Professor Jennifer Rexford.
Processes CSCI 444/544 Operating Systems Fall 2008.
Project 2 Roadmap. Background – Context Switching One processor and multiple threads running concurrently – How?!! Give each thread a small time quantum.
Unix Processes.
Project 1 Roadmap. Address Space Protection in GeekOS User Process 1 Base 1 Size 1 User Process 2 Base 2 Size 2 User Process n Base n Size n Kernel User.
Project 1 Roadmap.
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.
Ceng Operating Systems Chapter 2.1 : Processes Process concept Process scheduling Interprocess communication Deadlocks Threads.
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.
CMSC412 Fall’05 CMSC412 Project 0/1. CMSC412 Fall’05 The usual Info: csd.cmsc412 Recitation: CSI 2118; Mon.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
Process Description and Control A process is sometimes called a task, it is a program in execution.
Processes in Unix, Linux, and Windows CS-502 Fall Processes in Unix, Linux, and Windows CS502 Operating Systems (Slides include materials from Operating.
Process. Process Concept Process – a program in execution Textbook uses the terms job and process almost interchangeably A process includes: – program.
Process Description and Control Chapter 3. Major Requirements of an OS Interleave the execution of several processes to maximize processor utilization.
Copyright ©: Nahrstedt, Angrave, Abdelzaher1 Processes Tarek Abdelzaher Vikram Adve.
Process in Unix, Linux, and Windows CS-3013 A-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
Introduction to Processes CS Intoduction to Operating Systems.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Chapter 4 Processes. Process: what is it? A program in execution A program in execution usually usually Can also have suspended or waiting processes Can.
Processes and Threads CS550 Operating Systems. Processes and Threads These exist only at execution time They have fast state changes -> in memory and.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Shell (Part 2). Example r What if we want to support something like this: m ps –le | sort r One process should execute ps –le and another should execute.
1 Chapter 2.1 : Processes Process concept Process concept Process scheduling Process scheduling Interprocess communication Interprocess communication Threads.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 2-1: Process Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Threads G.Anuradha (Reference : William Stallings)
CE Operating Systems Lecture 10 Processes and process management in Linux.
Operating Systems Lecture November 2015© Copyright Virtual University of Pakistan 2 Agenda for Today Review of previous lecture Hardware (I/O, memory,
Shell (Addendum). Example r What if we want to support something like this: m ps –le | sort r One process should execute ps –le and another should execute.
System calls for Process management
Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.
Processes CS 6560: Operating Systems Design. 2 Von Neuman Model Both text (program) and data reside in memory Execution cycle Fetch instruction Decode.
We will focus on operating system concepts What does it do? How is it implemented? Apply to Windows, Linux, Unix, Solaris, Mac OS X. Will discuss differences.
Operating Systems Process Creation
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
Process Description and Control Chapter 3. Source Modified slides from Missouri U. of Science and Tech.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Processes and Threads.
Process Management Azzam Mourad COEN 346.
Page Replacement Implementation Issues Text: –Tanenbaum ch. 4.7.
System calls for Process management Process creation, termination, waiting.
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Memory Management Paging (continued) Segmentation
16.317: Microprocessor System Design I
Process Management Process Concept Why only the global variables?
Microprocessor Systems Design I
Protection of System Resources
Processes in Unix, Linux, and Windows
Processes in Unix, Linux, and Windows
Memory Management Paging (continued) Segmentation
More examples How many processes does this piece of code create?
CS 143A Quiz 1 Solution.
Processes in Unix, Linux, and Windows
System Structure and Process Model
Tutorial: The Programming Interface
Operating Systems Lecture 3.
Lecture 6: Multiprogramming and Context Switching
Processes in Unix, Linux, and Windows
Processes in Unix and Windows
CS510 Operating System Foundations
Memory Management Paging (continued) Segmentation
Threads CSE 2431: Introduction to Operating Systems
Presentation transcript:

Project 1 Roadmap

Overview Augment GeekOS to include: Background processes An ability to kill processes: Asynchronously From another process An ability to view status of active processes

Preliminaries How are processes implemented in GeekOS? How do processes use system calls to request kernel services?

Address Space Protection Protects against processes accessing : Another processes memory Kernel memory Logical addresses used Kernel controls what memory a process can access An interrupt is issued if the process attempts to access memory outside of its logical address space How is address space protection handled in GeekOS? Address Space Protection in GeekOS

Address Space Protection in GeekOS User Processn Sizen Basen User Process2 Base2 Size2 User Process1 Base1 Size1 User processes’ address spaces don’t overlap Kernel “sees” all address spaces Kernel

Address Space Protection in GeekOS Allow for the use of relative memory references Relative to the base of the current memory segment Linker must know where parts of the program will be w/ regards to the start of the executable image in memory.

Segmentation Principles Each user program has memory segments for code, data, stack, etc... Segment Descriptor size base privilegeLevel … User Process Kernel Address = User Address + Base Gives user processes the illusion they have their own world that starts at 0 Kernel

X86 Segmentation in GeekOS Segment Descriptor Base address Limit address Privilege Level Descriptors are stored in descriptor tables Two types of descriptor tables

Descriptor Tables Local Descriptor Table (LDT) Stores the segment descriptors for each use process. One per process Global Descriptor Table (GDT) Stores information for all of the process For each user process, a descriptor in the memory containing the corresponding LDT Pointer to the beginning of the user’s LDT and its size

X86 Segmentation in GeekOS User Processn User Process2 User Process1 GDT=Global Descriptor Table: holds LDT descriptors for user processes LDT=Local Descriptor Table: holds segment descriptors for user processes LDT Desc1 GDT LDT Desc2 LDT Descn

X86 Segmentation in GeekOS (implementation) User_Context GDT Selector struct Segment_Descriptor ldt[0] LDT descriptor struct Segment_Descriptor ldt[1] Selector struct Segment_Descriptor *ldtDescriptor ushort_t ldtSelector ushort_t csSelector Selector ushort_t dsSelector int stackAddr int programSize char * program

X86 Segmentation Intel docs, fig. 3-1 and 3-5

User Processes in GeekOS Kernel_Thread User Context Kernel_Thread User Context Kernel_Thread Kernel_Thread User Context Kernel_Thread User Processes

Lifetime of an User Process Shell spawns user processes using Spawn_With_Path(see src/user/shell.c) User processes termination Normally - via Exit,called automatically when main() finishes Killed - via Sys_Kill which you will implement Parent processes can wait for their children using Wait

System Calls Program may need to access memory i.e. for I/O, may need to access video memory outside of the processes’ segment OS provides a series of System Calls Routines that carry out some operation for the user process that calls it. Since routines in protected memory, user programs must send a processor interrupt using the int instruction. In GeekOS, INT90

System Calls INT90 put args in registers on user side recover them on kernel side call Sys_xxx accordingly Sys_Null, Sys_Exit (src/geekos/syscall.c) return result/error code Use g_CurrentThread to get info about current thread

Requirement #1:Background Processes Shell src/user/shell.c Modify code to handle forking process Parse commands and scan for & If & detected, spawn in background, don’t Wait() If & not detected, Spawn normally, do Wait() Sys_Spawn() src/geekos/syscall.c need to consider ‘spawn in background argument’

Requirement #2:Killing Background Processes Kernel:Sys_Kill() src/geekos/syscall.c Get the PID of the victim process Lookup the victim’s kernel_thread (see Lookup_Thread in src/geekos/kthread.c) Dequeue thread from all queues, and ‘kill’ it User Add src/user/kill.c for testing Add kill.c to USER_C_SRCS in build/Makefile to create an user program

Requirement #3:Printing the process table Kernel:Sys_PS() Return information about current processes src/geekos/syscall.c Prepare an struct Process_Info array in kernel space Walk all threads: s_allThreadList in src/geekos/kthread.c, fill out the above array Copy array into user space: Copy_To_User() User Add the ‘ps’ user program: src/user/ps.c , see req #2 Hit ‘ps’, ‘man ps’ in Linux to get an idea