Department of Computer Science Southern Illinois University Edwardsville Spring, 2010 Dr. Hiroshi Fujinoki CS 547/490 Network.

Slides:



Advertisements
Similar presentations
Concurrent Programming Problems OS Spring Concurrency pros and cons Concurrency is good for users –One of the reasons for multiprogramming Working.
Advertisements

Cpr E 308 Spring 2004 Recap for Midterm Introductory Material What belongs in the OS, what doesn’t? Basic Understanding of Hardware, Memory Hierarchy.
1 Threads CSCE 351: Operating System Kernels Witawas Srisa-an Chapter 4-5.
Concurrency: Deadlock and Starvation Chapter 6. Revision Describe three necessary conditions for deadlock Which condition is the result of the three necessary.
Inter Process Communication:  It is an essential aspect of process management. By allowing processes to communicate with each other: 1.We can synchronize.
Concurrency: Mutual Exclusion, Synchronization, Deadlock, and Starvation in Representative Operating Systems.
Threads© Dr. Ayman Abdel-Hamid, CS4254 Spring CS4254 Computer Network Architecture and Programming Dr. Ayman A. Abdel-Hamid Computer Science Department.
1 Interprocess Communication Race Conditions Two processes want to access shared memory at same time.
CS252: Systems Programming Ninghui Li Final Exam Review.
CS 447 Networks and Data Communication
CS 447 Networks and Data Communication
MIPS R3000 Subroutine Calls and Stack Department of Computer Science Southern Illinois University Edwardsville Fall, 2015 Dr. Hiroshi Fujinoki
CS 447 Networks and Data Communication
Department of Computer Science Southern Illinois University Edwardsville Spring, 2010 Dr. Hiroshi Fujinoki CS 547/490 Network.
Chapter 2 (PART 1) Light-Weight Process (Threads) Department of Computer Science Southern Illinois University Edwardsville Summer, 2004 Dr. Hiroshi Fujinoki.
Datapath Architecture Department of Computer Science Southern Illinois University Edwardsville Fall, 2015 Dr. Hiroshi Fujinoki
CS 447 Networks and Data Communication Department of Computer Science Southern Illinois University Edwardsville Fall, 2013 Dr. Hiroshi Fujinoki
Department of Computer Science Southern Illinois University Edwardsville Spring, 2008 Dr. Hiroshi Fujinoki FTP Protocol Programming.
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 2 Processes and Threads Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Parallel Computers Organizations and Architecture Department of Computer Science Southern Illinois University Edwardsville Summer, 2015 Dr. Hiroshi Fujinoki.
CS 312 Computer Architecture Memory Basics Department of Computer Science Southern Illinois University Edwardsville Summer, 2015 Dr. Hiroshi Fujinoki
Bit and Framing Errors for Asynchronous Signal Transmissions Department of Computer Science Southern Illinois University Edwardsville Fall, 2013 Dr. Hiroshi.
Hyper Threading (HT) and  OPs (Micro-Operations) Department of Computer Science Southern Illinois University Edwardsville Summer, 2015 Dr. Hiroshi Fujinoki.
Cpr E 308 Spring 2004 Real-time Scheduling Provide time guarantees Upper bound on response times –Programmer’s job! –Every level of the system Soft versus.
CS 447 Networks and Data Communication ARP (Address Resolution Protocol) for the Internet Department of Computer Science Southern Illinois University Edwardsville.
Department of Computer Science Southern Illinois University Edwardsville Fall, 2013 Dr. Hiroshi Fujinoki MANET (Mobile Ad-hoc.
Technical Details for sockaddr_in Structure Department of Computer Science Southern Illinois University Edwardsville Fall, 2015 Dr. Hiroshi Fujinoki
Department of Computer Science Southern Illinois University Edwardsville Spring, 2010 Dr. Hiroshi Fujinoki IPC1.PPT/001 Inter-Process.
Chapter 1 (PART 1) Introduction to OS (concept, evolution, some keywords) Department of Computer Science Southern Illinois University Edwardsville Summer,
Distance-Vector Routing Department of Computer Science Southern Illinois University Edwardsville Fall, 2013 Dr. Hiroshi Fujinoki
CS 447 Network & Data Communication QoS Implementation for the Internet IntServ and DiffServ Department of Computer Science Southern Illinois University.
Operating System Concepts Part II Department of Computer Science Southern Illinois University Edwardsville Spring, 2009 Dr. Hiroshi Fujinoki
Department of Computer Science Southern Illinois University Edwardsville Spring, 2008 Dr. Hiroshi Fujinoki FTP Protocol Programming.
Chapter 7 - Interprocess Communication Patterns
Chapter 1 (PART 2) Operating System Concepts Department of Computer Science Southern Illinois University Edwardsville Spring, 2016 Dr. Hiroshi Fujinoki.
Introduction Contain two or more CPU share common memory and peripherals. Provide greater system throughput. Multiple processor executing simultaneous.
Producer-Consumer Problem David Monismith cs550 Operating Systems.
Welcome to CS314 Operating Systems A Quick Tour for Introduction to OS Department of Computer Science Southern Illinois University Edwardsville Spring,
Uniprocessor Process Management & Process Scheduling Department of Computer Science Southern Illinois University Edwardsville Spring, 2016 Dr. Hiroshi.
Readers/Writers Problem  Multiple processes wanting to read an item, and one or more needing to write (Think of airline reservations…)  Rather than enforce.
CS 447 Networks and Data Communication Server-Process Organization IP address and SockAddr_In Data Structure Department of Computer Science Southern Illinois.
File System Department of Computer Science Southern Illinois University Edwardsville Spring, 2016 Dr. Hiroshi Fujinoki CS 314.
OS Boot Sequence and File System (implication to “Boot Sector Viruses”) Department of Computer Science Southern Illinois University Edwardsville Spring,
Deadlock Prevention & Avoidance Department of Computer Science Southern Illinois University Edwardsville Spring, 2016 Dr. Hiroshi Fujinoki
Interprocess Communication Race Conditions
“Language Mechanism for Synchronization”
Process Synchronization
CS 286 Computer Organization and Architecture
Inter-Process Communication and Synchronization
MODERN OPERATING SYSTEMS Third Edition ANDREW S
COMS Prelim 1 Review Session
Concurrency: Mutual Exclusion and Process Synchronization
CS 286 Computer Organization and Architecture
CS 286 Computer Organization and Architecture
Introduction to OS (concept, evolution, some keywords)
Deadlock Prevention & Avoidance
, Part II Process Synchronization
Process Synchronization
Introduction to OS (concept, evolution, some keywords)
Department of Computer Science
Process/Code Migration and Cloning
Department of Computer Science
Operating System Concepts
Threads: Light-Weight Processes
Operating System Concepts
Deadlock Prevention & Avoidance
Process Synchronization
Light-Weight Process (Threads)
Lecture 4: File-System Interface
Uniprocessor Process Management & Process Scheduling
Presentation transcript:

Department of Computer Science Southern Illinois University Edwardsville Spring, 2010 Dr. Hiroshi Fujinoki CS 547/490 Network Programming Semaphore and Shared Memory IPC2.PPT/001

CS 547/490 Network Programming What is a problem in “pipe”? Not flexible - only FIFO queue is implemented FIFO Other Data Structures Stack Tree Heap Binary-Tree B-Tree List Table Link-List IPC2.PPT/002

CS 547/490 Network Programming What is a problem in “pipe” (continued)? Not flexible - only FIFO queue is implemented A solution: Semaphore + Shared Memory = similar to pipe, but almost any data structure can be implemented by “semaphore + shared memory” IPC2.PPT/003

CS 547/490 Network Programming Shared Memory: Shared memory is a piece of memory space that does not belong to any particular user process. Shared memory can be accessed (shared) by multiple processes. Shared memory is created by OS. Two processes can send and receive data through shared memory No limitation in the order data is accessed (and even bi-directional) Race condition is there (users are responsible for avoiding race condition) IPC2.PPT/004

CS 547/490 Network Programming OS Allocate/Manage Shared Memory WRITE READ Process 2 Process 1 Can access any address within a shared memory Property of Shared Memory (1) “Random Access” is possible IPC2.PPT/005 Not FIFO any more

CS 547/490 Network Programming OS Allocate/Manage Shared Memory READ WRITE Process 2 Process 1 Property of Shared Memory (2) No limitation in “direction” WRITE READ IPC2.PPT/006

CS 547/490 Network Programming OS Shared Memory Process 2 Process 1 READ WRITE READ OS does NOT provide protection against race-condition Property of Shared Memory (3) No protection from “Race Condition” IPC2.PPT/007

Time Server OS CS 547/490 Network Programming Application Example Writer Process Time Keeper (Delta Time) Client 1 Client 2 Client n Remote Client 1 Remote Client 2 Remote Client n Shared Memory 12:59:59 IPC2.PPT/008

CS 547/490 Network Programming (1) Multiple readers can simultaneously access to the clock (2) When the time keeper (= writer) updates the time, no client can access (3) Once the time keeper leaves, multiple clients can access to the clock Access Rules to the Shared Memory IPC2.PPT/009

CS 547/490 Network Programming START Writer? accept create shared memory folk Time Keeper YES folk Client NO IPC2.PPT/010

CS 547/490 Network Programming IPC2.PPT/011 Time Keeper (Writer) Time Client (Reader) reader_count = reader_count +1; if (reader_count = 1) wait (writer); wait (mutex); signal (mutex); reader_count = reader_count -1; if (reader_count = 0) signal (writer); wait (mutex); signal (mutex); wait (writer); signal (writer); The Time Keeper Updates the current time A reader reads the current time writer, mutex = binary (mutual exclusion) semaphore