Minix Overview & System Call Implementation Sankara Narayanan. CSE 785 Computer Security, Syracuse University, NY Spring 2003 – 2004.

Slides:



Advertisements
Similar presentations
Operating Systems Manage system resources –CPU scheduling –Process management –Memory management –Input/Output device management –Storage device management.
Advertisements

Chap 2 System Structures.
Discussion Week 4 TA: Kyle Dewey. Overview Project #1 debriefing System calls Project #2.
11/13/01CS-550 Presentation - Overview of Microsoft disk operating system. 1 An Overview of Microsoft Disk Operating System.
Process management in Minix1 Processes Process is a program in execution. Program is a static entity while process is an active entity. Process Control.
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
1/28/2004CSCI 315 Operating Systems Design1 Operating System Structures & Processes Notice: The slides for this lecture have been largely based on those.
Guide To UNIX Using Linux Third Edition
MINIX Operating System Presented by: Pravendra Lohiya.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 2: Operating-System Structures Modified from the text book.
POSIX: Files Introduction to Operating Systems: Discussion 1 Read Solaris System Interface Guide: Ch. 5.1 Basic File I/O.
System Calls 1.
Outcome 2 – Computer Software The Range of Software Available The Different Categories of Software System Software Programming Languages Applications Software.
COMP 3438 – Part I - Lecture 4 Introduction to Device Drivers Dr. Zili Shao Department of Computing The Hong Kong Polytechnic Univ.
Providing Policy Control Over Object Operations in a Mach Based System By Abhilash Chouksey
Exploring an Open Source Automation Framework Implementation.
10/16/ Realizing Concurrency using the thread model B. Ramamurthy.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 6 System Calls OS System.
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.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Overview Part 2: History (continued)
Operating Systems Lecture 7 OS Potpourri Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of Software.
B. RAMAMURTHY 10/24/ Realizing Concurrency using the thread model.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
Slide 3-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 3.
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.
Operating Systems Lecture November 2015© Copyright Virtual University of Pakistan 2 Agenda for Today Review of previous lecture Hardware (I/O, memory,
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.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
UNIX Unit 1- Architecture of Unix - By Pratima.
A. Frank - P. Weisberg Operating Systems Structure of Operating Systems.
M. Accetta, R. Baron, W. Bolosky, D. Golub, R. Rashid, A. Tevanian, and M. Young MACH: A New Kernel Foundation for UNIX Development Presenter: Wei-Lwun.
The Mach System Silberschatz et al Presented By Anjana Venkat.
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.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Introduction to UNIX CS 2204 Class meeting 1 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
Cs431-cotter1 Processes and Threads Tanenbaum 2.1, 2.2 Crowley Chapters 3, 5 Stallings Chapter 3, 4 Silberschaz & Galvin 3, 4.
What is a Process ? A program in execution.
Introduction Contain two or more CPU share common memory and peripherals. Provide greater system throughput. Multiple processor executing simultaneous.
MINIX 3 – Introduction Béat Hirsbrunner Lecture 1, 18 September 2012 Main reference Andrew S. Tanenbaum, Albert S. Woodhull Operating Systems : Design.
MINIX Presented by: Clinton Morse, Joseph Paetz, Theresa Sullivan, and Angela Volk.
1 COMP 3500 Introduction to Operating Systems Project 4 – Processes and System Calls Part 3: Adding System Calls to OS/161 Dr. Xiao Qin Auburn University.
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.
7/9/ Realizing Concurrency using Posix Threads (pthreads) B. Ramamurthy.
WORKING OF SCHEDULER IN OS
Introduction to Operating Systems Concepts
Computer System Structures
Introduction to Kernel
Kernel Design & Implementation
User-Written Functions
Session 3 Memory Management
Realizing Concurrency using the thread model
Protection of System Resources
CS 3305 System Calls Lecture 7.
KERNEL ARCHITECTURE.
Operation System Program 4
OS Organization.
Threads and Data Sharing
Realizing Concurrency using the thread model
Chapter 2: System Structures
CGS 3763 Operating Systems Concepts Spring 2013
Operating Systems Lecture 3.
Outline Chapter 2 (cont) OS Design OS structure
Realizing Concurrency using the thread model
Operating Systems: A Modern Perspective, Chapter 3
OS Organization.
Outline Operating System Organization Operating System Examples
In Today’s Class.. General Kernel Responsibilities Kernel Organization
Presentation transcript:

Minix Overview & System Call Implementation Sankara Narayanan. CSE 785 Computer Security, Syracuse University, NY Spring 2003 – 2004

What will be Covered!!!! Overview of the Minix Operating System The Architecture of Minix Implementation of System Calls – How it works Conclusion

Introduction – About Minix Minix – Mini Unix (Minix) basically, a UNIX - compatible operating system. Minix is small in size, with microkernel- based design. Minix has been kept (relatively) small and simple. Minix is small, it is nevertheless a preemptive, multitasking operating system.

Continued Modularity in Minix Multiprogramming (Multiple programs can be run at once) Source Code – C language Networking support – TCP/IP protocol

Architecture – Which You must be familiar.. The figure represents the internal architecture of Minix. User Processes init, login, passwd, sh, ls, cp, cc,……….. Server Processes File System (FS), Memory Manager (MM) Kernel I/O Tasks Floppy, tty, clock, system, ………… Kernel Process Management Interrupt handlers Different Layers

Source Code/ Directory Structure commands fs – file system kernel – kernel codes Solaris tools mm – memory manager All these folders you find under your /src folder

System Calls – Flow of Control The flow of control in minix from the user level the kernel level is handled by system calls. Minix has a set of system calls which are located in the table.c file. The file system (fs) has its own table and so the memory(mm), but the number of system calls is fixed.

Continued…System Calls… System call in minix is similar to a system, call in any system. A user-level process cannot directly access a disk. Instead it asks the kernel to obtain data from a file for it (the read system call). A user-level process cannot create another process. Instead, it asks the kernel to create one for it. User Program ==> Library ----> Kernel ==> MM/FS

Continued…System calls… System calls are typically made via library routines. Library routines are normal procedure calls. They perform the setup for the system call. In minix the system call functions in a similar fashion. The prototype of the libraries are defined in /usr/include/unistd.h or other header files according to the system call /usr/include/unistd.h

Continued….System Call…. To implement a system call in minix one needs to do the following steps. Look for a free slot in the table.c file Follow the standard convention no_sys, /* 0 = unused */ do_exit, /* 1 = exit */ do_fork, /* 2 = fork */ do_acl /* 77 = acl */  your system call entry

Continued ….. System Call… The system call would be named in the following manner do_acl or do_encrypt Once the system call method has been written its declaration should be mentioned in the function declaration header file in the file system it is “ proto.h ” _PROTOTYPE ( return type do_XXXX, (arguments if any));

Continued….System Call… The library should also be informed about the system call that would be called by the user. The library file for the system call is written in the lib/posix directory. The file naming convention is followed here it starts with an underscore Eg: - _fork.c (this code is defined in /lib/posix) #include #define fork _fork #include PUBLIC pid_t fork() { message m; return(_syscall(MM, FORK, &m)); } When you add a new system call, you need to add code as above.

Continued….System Call… It calls _syscall (MM, FORK, &m);. The first parameter is the destination. This is always MM/FS. When kernel receives a system call request, what the kernel do is to send message to MM/FS. Actual work is done by MM/FS. The second parameter specifies the type of service. The ID is defined in /usr/include/minix/callnr.h. User program cannot call _syscall() or directly. The structure of message is defined in /usr/include/minix/type.h./usr/include/minix/callnr.h

Continued….System Call… Once the code for the system call is written in the "lib/other" directory a system file needs to be created. The system file is present in the "lib/sunsyscall" directory. A standard naming convention is followed here to. The filename extension is ".s"..global systemcallname systemcallname: ba_systemcallname nop

Continued…System Call… A system call will contain a user created command file which when compiled creates a binary executable command. the command is created in the “ commands/simple ” directory ”. The file once compiled creates an executable binary in the “ commands/simple/bin ” directory. You will need to do a sunread to get the bin from the solaris system to the minix system

Continued…System Call… All the headers used in the system calls are kept in the "include" directory. The "type.h " header file is a very important and most useful header file. To pass a message a variable of a specific data type is defined, and the variable is added to the message structure as I had shown in the example below. The message structure defined is as follows:

Continued…System Call… Typedef struct { datatype mnYY; } mess_n; n => message number of the message YY => variable name The size of the structure defined in the message is also an important factor as if the size of the message is increased then the system crashes. Typedef struct { char *m1sb; } mess_1; #define m1_sb m_u.m_m1.m1sb; To add data in the message variable the following need to be done Message m; m.m1_sb = data

Conclusion The End Thank You