Basic Networking & Interprocess Communication Vivek Pai Nov 27, 2001.

Slides:



Advertisements
Similar presentations
Categories of I/O Devices
Advertisements

CS 4700 / CS 5700 Network Fundamentals
Chapter 17 Networking Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William.
Umut Girit  One of the core members of the Internet Protocol Suite, the set of network protocols used for the Internet. With UDP, computer.
CCNA – Network Fundamentals
CS3505 The Internet and Info Hiway transport layer protocols : TCP/UDP.
Flash: An efficient and portable Web server Authors: Vivek S. Pai, Peter Druschel, Willy Zwaenepoel Presented at the Usenix Technical Conference, June.
Fast Communication Firefly RPC Lightweight RPC  CS 614  Tuesday March 13, 2001  Jeff Hoy.
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public 1 Version 4.0 Network Services Networking for Home and Small Businesses – Chapter 6.
Network Layer and Transport Layer.
Lecture 3 Page 1 CS 239, Spring 2001 Interprocess Communications in Distributed Operating Systems CS 239 Distributed Operating Systems April 9, 2001.
1 Java Networking – Part I CS , Spring 2008/9.
Precept 3 COS 461. Concurrency is Useful Multi Processor/Core Multiple Inputs Don’t wait on slow devices.
I/O Hardware n Incredible variety of I/O devices n Common concepts: – Port – connection point to the computer – Bus (daisy chain or shared direct access)
CS3771 Today: network programming with sockets  Previous class: network structures, protocols  Next: network programming Sockets (low-level API) TODAY!
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.1 Computer Networks and Internets with Internet Applications, 4e By Douglas.
Computer Science Lecture 2, page 1 CS677: Distributed OS Last Class: Introduction Distributed Systems – A collection of independent computers that appears.
Basic Networking Vivek Pai Nov 26, Communication  You’ve already seen some of it –Web server project(s)  Machines have “names” –Human-readable.
CS-3013 & CS-502, Summer 2006 Network Input & Output1 CS-3013 & CS-502, Summer 2006.
WXES2106 Network Technology Semester /2005 Chapter 8 Intermediate TCP CCNA2: Module 10.
Internet Basics.
Gursharan Singh Tatla Transport Layer 16-May
UNIX Sockets COS 461 Precept 1. Clients and Servers Client program – Running on end host – Requests service – E.g., Web browser Server program – Running.
TCP Sockets Reliable Communication. TCP As mentioned before, TCP sits on top of other layers (IP, hardware) and implements Reliability In-order delivery.
CS252: Systems Programming Ninghui Li Final Exam Review.
Socket Programming -What is it ? -Why bother ?. Basic Interface for programming networks at transport level It is communication end point Used for inter.
TCP/IP protocols Communication over Internet is mostly TCP/IP (Transmission Control Protocol over Internet Protocol) TCP/IP "stack" is software which allows.
Midterm Review - Network Layers. Computer 1Computer 2 2.
Chapter 17 Networking Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William Stallings.
Presentation on Osi & TCP/IP MODEL
Lecture 2 TCP/IP Protocol Suite Reference: TCP/IP Protocol Suite, 4 th Edition (chapter 2) 1.
1 Semester 2 Module 10 Intermediate TCP/IP Yuda college of business James Chen
Distributed Systems. Interprocess Communication (IPC) Processes are either independent or cooperating – Threads provide a gray area – Cooperating processes.
Chapter 5 Transport layer With special emphasis on Transmission Control Protocol (TCP)
Jozef Goetz, Application Layer PART VI Jozef Goetz, Position of application layer The application layer enables the user, whether human.
Operating Systems Lecture 2 Processes and Threads Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of.
ICOM 6115©Manuel Rodriguez-Martinez ICOM 6115 – Computer Networks and the WWW Manuel Rodriguez-Martinez, Ph.D. Lecture 26.
1 The Internet and Networked Multimedia. 2 Layering  Internet protocols are designed to work in layers, with each layer building on the facilities provided.
User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.
Dr. John P. Abraham Professor University of Texas Pan American Internet Applications and Network Programming.
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.
TCP Sockets Reliable Communication. TCP As mentioned before, TCP sits on top of other layers (IP, hardware) and implements Reliability In-order delivery.
1 Computer Networks An Introduction to Computer Networks University of Tehran Dept. of EE and Computer Engineering By: Dr. Nasser Yazdani Lecture 3: Sockets.
CE Operating Systems Lecture 13 Linux/Unix interprocess communication.
Networking Basics CCNA 1 Chapter 11.
Processes CSCI 4534 Chapter 4. Introduction Early computer systems allowed one program to be executed at a time –The program had complete control of the.
Socket Programming Lab 1 1CS Computer Networks.
Socket Programming Introduction. Socket Definition A network socket is one endpoint in a two-way communication flow between two programs running over.
The Client-Server Model And the Socket API. Client-Server (1) The datagram service does not require cooperation between the peer applications but such.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
UNIT-6. Basics of Networking TCP/IP Sockets Simple Client Server program Multiple clients Sending file from Server to Client Parallel search server.
LECTURE 10 Networking. NETWORKING IN PYTHON Many Python applications include networking – the ability to communicate between multiple machines. We are.
Inter-Process Communication 9.1 Unix Sockets You may regard a socket as being a communication endpoint. –For two processes to communicate, both must create.
1 Kyung Hee University Chapter 11 User Datagram Protocol.
1 Network Communications A Brief Introduction. 2 Network Communications.
CPS110: Networks Landon Cox March 25, Network hardware reality  Lots of different network interface cards (NICs)  3Com/Intel, Ethernet/802.11x.
Sockets Intro to Network Programming. Before the internet... Early computers were entirely isolated No Internet No network No model No external communications.
SOCKET PROGRAMMING Presented By : Divya Sharma.
Chapter 9: Transport Layer
Last Class: Introduction
Instructor Materials Chapter 9: Transport Layer
Sockets and Beginning Network Programming
CS 6560: Operating Systems Design
Lecture 6: TCP/IP Networking 1nd semester By: Adal ALashban.
Starting TCP Connection – A High Level View
CPEG514 Advanced Computer Networkst
CSCD 330 Network Programming
Chapter 13: I/O Systems.
Exceptions and networking
Presentation transcript:

Basic Networking & Interprocess Communication Vivek Pai Nov 27, 2001

2 Everyone’s Getting Sick  Including me –Didn’t assign reading in syllabus –Did get rough grades computed –Still have one feedback missing –Putting off new project this week

3 Mechanics  Next project assigned next Tuesday  Only 5 projects instead of 6  Target: use threads, synchronization –Probably using webserver again –Not building on filesystem –Suggestions welcome  We’ve completely neglected the dining philosophers problem!

4 Dining Philosophers

5 Possible Solutions  Philosophers go in order  Place numbers on forks  If stuck, drop fork, try again  Defer by age or some other quantity  Stab each other

6 Deadlock “Solutions”  Eliminate parallelism  Order resources, grab in order  Determine priorities on contention  Restart & randomize Deadlock performance: cost of avoiding/detecting deadlock versus work frequency & work thrown away

7 Original Lecture Goals  Basic networking - Introduce the basics of networking, the new semantics versus standard file system calls, and how this affects the programming model. Discuss network basics such as naming, ports, connections, protocols, etc.  Interprocess communication - Show how “networking” is useful within a single machine to communicate data. Give examples of different domains, how they are implemented, and the effects within the kernel. Show how networking and interprocess communication can be used to allow easy distribution of applications.

8 Communication  You’ve already seen some of it –Web server project(s)  Machines have “names” –Human-readable names are convenience –“Actual” name is IP (Internet Protocol) address –For example, means “this machine” –nslookup gives www.cs.princeton.edu

9 Names & Services  Multiple protocols –ssh, ftp, telnet, http, etc. –How do we know how to connect?  Machines also have port numbers –16 bit quantity ( ) –Protocols have default port # –Can still do “telnet ”

10 But The Web Is Massive  Possible names >> possible IP addresses –World population > possible IP addresses –Many names map to same IP addr –Use extra information to disambiguate –In HTTP, request contains “Host: name” header  Many connections to same (machine, port #) –Use (src addr, src port, dst addr, dst port) to identify connection

11 Circuit Switching versus Packet Switching  Circuit – reserve resources in advance –Hold resources for entire communication –Example: phone line  Packet – break data into small pieces –Pieces identify themselves, “share” links –Individual pieces routed to destination –Example: internet –Problem: no guarantee pieces reach

12 Who Got Rich By Packet Switching?

13 The “End To End” Argument  Don’t rely on lower layers of the system to ensure something happens  If it needs to occur, build the logic into the endpoints  Implications: –Intermediate components simplified –Repetition possible at endpoints (use OS)  What is reliability?

14 Do Applications Care?  Some do  Most don’t –Use whatever OS provides –Good enough for most purposes  What do applications want? –Performance –Simplicity

15 Reading & Writing  A file: –Is made into a “descriptor” via some call –Is an unstructured stream of bytes –Can be read/written –OS provides low-level interaction –Applications use read/write calls  Sounds workable?

16 Network Connections As FDs  Network connection usually called “socket”  Interesting new system calls –socket( ) – creates an fd for networking use –connect( ) – connects to the specified machine –bind( ) – specifies port # for this socket –listen( ) – waits for incoming connections –accept( ) – gets connection from other machine  And, of course, read( ) and write( )

17 New Semantics  Doing a write( ) –What’s the latency/bandwidth of a disk? –When does a write( ) “complete”? –Where did data actually go before? –Can we do something similar now?  What about read( ) –When should a read return? –What should a read return?

18 Buffering  Provided by OS –Memory on both sender and receiver sides –Sender: enables reliability, quick writes –Receiver: allows incoming data before read  Example – assume slow network –write(fd, buf, size); –memset(buf, 0, size) –write(fd, buf, size);

19 Interprocess Communications  Shared memory –Threads sharing address space –Processes memory-mapping the same file –Processes using shared memory system calls  Sockets and read/write –Nothing prohibits connection to same machine –Even faster mechanism – different “domain” –Unix domain (local) versus Internet (either)

20 Sockets vs Shared Memory  Sockets –Higher overhead –No common parent/file needed –Synchronous operation  Shared memory –Locking due to synchronous operation –Fast reads/writes – no OS intervention –Harder to use multiple machines

21 Even More Semantics  How do you express the following: –Do (task) until (message received) –Do (this task) until (receiver not ready) –Do (task) until (no more data)  Problem: implies knowing system behavior  Related: what happens when buffer fills/empties? (hint: think of filesystem)

22 Synchronous vs Asynchronous  Synchronous: do it now, wait until over  Asynchronous: start it now, check later Somewhat related:  Blocking: wait until it’s all done  Nonblocking: only do what can be done without blocking

23 Transferring Large Files  OS buffers are 16-64KB  Large files are >> buffer size  Assume two clients –Each requests a different large file –Both are on slow networks How do you design your server?

24 Server Design Choices  Processes –Each client handled by a different process  Threads –Each client handled by a different thread  Single process –Use nonblocking operations, multiplex

25 Processing Steps Read File Send Data Accept Conn Read Request Find File Send Header end

26 Blocking Steps Read File Send Data Accept Conn Read Request Find File Send Header end Network Blocking Disk Blocking

27 Concurrency Architecture  Overlap disk, network, & application-level processing  Architecture how steps are overlapped Note: implications for performance

28 Multiple Processes (MP) Pro: simple programming – rely on OS Cons:too many processes caching harder Process 1 Read File Send Data Accept Conn Read Request Find File Send Header Process N Read File Send Data Accept Conn Read Request Find File Send Header

29 Multiple Threads (MT) Pro: shared address space lower “context switch” overhead Cons:many threads requires kernel thread support synchronization needed Read File Send Data Accept Conn Read Request Find File Send Header

30 Single Process Event Driven (SPED) Pro: single address space no synchronization Cons:must explicitly handle pieces in practice, disk reads still block Read File Send Data Accept Conn Read Request Find File Send Header Event Dispatcher

31 Homework  Read about the select( ) system call  Reading from syllabus  I may send an with papers