OS2014 PROJECT 2 Supplemental Information. Outline Sequence Diagram of Project 2 Kernel Modules Kernel Sockets Work Queues Synchronization.

Slides:



Advertisements
Similar presentations
1 Symbian Client Server Architecture. 2 Client, who (a software module) needs service from service provider (another software module) Server, who provide.
Advertisements

Slide 2-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 2 Using the Operating System 2.
Chapter 7 Protocol Software On A Conventional Processor.
ECE 526 – Network Processing Systems Design Software-based Protocol Processing Chapter 7: D. E. Comer.
04/14/2008CSCI 315 Operating Systems Design1 I/O Systems Notice: The slides for this lecture have been largely based on those accompanying the textbook.
OS2-1 Chapter 2 Computer System Structures. OS2-2 Outlines Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 5: Threads Overview Multithreading Models Threading Issues Pthreads Solaris.
Precept 3 COS 461. Concurrency is Useful Multi Processor/Core Multiple Inputs Don’t wait on slow devices.
Inter Process Communication:  It is an essential aspect of process management. By allowing processes to communicate with each other: 1.We can synchronize.
9/20/6Lecture 3 - Instruction Set - Al Hardware interface (part 2)
1 I/O Management in Representative Operating Systems.
Chapter 6 - Implementing Processes, Threads and Resources Kris Hansen Shelby Davis Jeffery Brass 3/7/05 & 3/9/05 Kris Hansen Shelby Davis Jeffery Brass.
Fundamentals of Python: From First Programs Through Data Structures
I/O Tanenbaum, ch. 5 p. 329 – 427 Silberschatz, ch. 13 p
Hacking the Bluetooth Pairing Authentication Process Graduate Operating System Mini Project Siyuan Jiang and Haipeng Cai.
Operating System Program 5 I/O System DMA Device Driver.
1 Input/Output. 2 Principles of I/O Hardware Some typical device, network, and data base rates.
General System Architecture and I/O.  I/O devices and the CPU can execute concurrently.  Each device controller is in charge of a particular device.
Chapter 17 Networking Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William Stallings.
Segmentation & O/S Input/Output Chapter 4 & 5 Tuesday, April 3, 2007.
2.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 2: Computer-System Structures Computer System Operation I/O Structure.
CHAPTER 2: COMPUTER-SYSTEM STRUCTURES Computer system operation Computer system operation I/O structure I/O structure Storage structure Storage structure.
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment.
1 CSE Department MAITSandeep Tayal Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
Server Sockets: A server socket listens on a given port Many different clients may be connecting to that port Ideally, you would like a separate file descriptor.
ICOM 6115©Manuel Rodriguez-Martinez ICOM 6115 – Computer Networks and the WWW Manuel Rodriguez-Martinez, Ph.D. Lecture 26.
Dr. John P. Abraham Professor University of Texas Pan American Internet Applications and Network Programming.
Operating Systems Lecture 7 OS Potpourri Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of Software.
Chapter 2 Applications and Layered Architectures Sockets.
The Socket Interface Chapter 21. Application Program Interface (API) Interface used between application programs and TCP/IP protocols Interface used between.
Li Tak Sing COMPS311F. Case study: consumers and producers A fixed size buffer which can hold at most certain integers. A number of producers which generate.
Middleware Services. Functions of Middleware Encapsulation Protection Concurrent processing Communication Scheduling.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 2 Computer-System Structures Slide 1 Chapter 2 Computer-System Structures.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 5: Threads Overview Multithreading Models Threading Issues Pthreads Solaris.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 14 Threads 2 Read Ch.
The Client-Server Model And the Socket API. Client-Server (1) The datagram service does not require cooperation between the peer applications but such.
Silberschatz, Galvin and Gagne  Applied Operating System Concepts Chapter 2: Computer-System Structures Computer System Architecture and Operation.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Processes and Threads.
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Input/Output – 2 I/O Software CS 342 – Operating Systems Ibrahim Korpeoglu.
Introduction Contain two or more CPU share common memory and peripherals. Provide greater system throughput. Multiple processor executing simultaneous.
1 Network Communications A Brief Introduction. 2 Network Communications.
SPL/2010 Reactor Design Pattern 1. SPL/2010 Overview ● blocking sockets - impact on server scalability. ● non-blocking IO in Java - java.niopackage ●
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
WORKING OF SCHEDULER IN OS
Introduction to Operating Systems Concepts
Input/Output (I/O) Important OS function – control I/O
Client-Server Communication
Chapter 13: I/O Systems Modified by Dr. Neerja Mhaskar for CS 3SH3.
Chapter 2: Computer-System Structures(Hardware)
Chapter 2: Computer-System Structures
Processes and threads.
Protection of System Resources
Module 4 Remote Login.
Want to play a game? – Linux Kernel Modules
UNIX Sockets Outline Homework #1 posted by end of day
Module 2: Computer-System Structures
CS703 - Advanced Operating Systems
Slides for Chapter 6: Operating System support
Operating Systems Lecture 3.
Threaded Programming in Python
Module 2: Computer-System Structures
LINUX System : Lecture 7 Lecture notes acknowledgement : The design of UNIX Operating System.
System Calls System calls are the user API to the OS
Chapter 2: Computer-System Structures
Chapter 2: Computer-System Structures
Module 2: Computer-System Structures
Module 2: Computer-System Structures
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

OS2014 PROJECT 2 Supplemental Information

Outline Sequence Diagram of Project 2 Kernel Modules Kernel Sockets Work Queues Synchronization

Sequence Diagram (1/2)

Sequence Diagram (2/2) The diagram illustrates one possible situation. The actual sequence might differ from the diagram due to different manipulation. Only the following orders are guaranteed. The slave program will be executed only after both device modules have been loaded. The master program will be executed only after the master device module has been loaded. In the slave program, it first set the IP address and then begin reading data from the slave device with blocking I/O. Your design should not depend on any particular orders not defined here.

A Mini Example In the following slides, we will go through the necessary kernel APIs for this project with a mini example. In this example, it create a TCP server and read one line of texts from the client. The data is also cached for reading from user space. Please note that there are some possible race conditions in design. All details can be found in the attached example. bz2 bz2

Kernel Modules (1/2) A character device (cdev) is a device supporting data manipulation in bytes. To create a character device, we need to do the following initialization. Requesting a range of device numbers by alloc_chrdev_region Initializing a cdev object and specifying the file operations of this device by cdev_init Adding the device to the kernel by cdev_add The device file can be created as follows. Adding a new device class by class_create Creating a device file with the specified device number and file name by device_create

Kernel Modules (2/2) The file operations, such as open, read, write, etc., of the character device is specified by the structure file_operations. For example, the function pointer release in the structure should point to the function which will be called when the system call close is invoked over the device file in user space.

Kernel Sockets (1/2) Kernel sockets have the similar interface as the BSD-style sockets. Since it will be blocked when waiting incoming connections, we should put it in a separated thread through work queues. In this example, the entry function of the work is miniex_work_handler. The incoming connections will be handled in the infinite loop.

Kernel Sockets (2/2) You can use miniex_recv/miniex_send to receive and send data with a socket. The data buffer must be in kernel space, which means you need to copy the data from/to user space by copy_from_user/copy_to_user.

Work Queues In the Linux kernel, a work queue is used for deferred works. Each work will be executed asynchronously in a kernel thread. A work queue can be created by the function create_workqueue. It takes an input parameter specifying the name of this work queue, which can be an arbitrary text string. A work can be defined by the macro DECLARE_WORK. A work can be put in the work queue by the function queue_work. It takes two input parameters specifying the work queue and the defined work.

Synchronization In the Linux kernel, a wait queue implements a conditional variable. A work queue can be defined by the macro DECLARE_WAIT_QUEUE_HEAD. To wait on a conditional variable, use the function wait_event_interruptible. The execution will be blocked until the specified condition evaluates to a true value or some signals occur. To wake the tasks wait on a conditional variable, use the function wake_up_interruptible.