CS 321 Spring 2013  >  Lecture Notes for Monday, April 8, 2013

# CS 321 Spring 2013 Lecture Notes for Monday, April 8, 2013

## Other Resource-Contension Issues

### Two-Phase Locking

This is a way of preventing deadlock by doing acquisition in two phases. First, a process requests all resources in a non-blocking manner. If they are all acquired, they are used and released. If any resource is not acquired, then all are released, and we start over.

Lost messages (for example) can cause a kind of deadlock that is not related to resource allocation. Suppose process A is waiting for a message from process B; when it is received, A will reply. B sends the message to A, and then waits for the reply. Now, if the initial message is lost, then each process will wait for the other forever. We have deadlock, but there are no resources involved.

### Livelock

Like deadlock, but with busy-waiting instead of blocking. Processes are all running, but not accomplishing anything.

### Starvation

If resources are allocated preferentially to certain processes, and these processes continually make requests, then other processes may never get access.

## Introduction to Networking

### Basics

Networking means automatically transferring data from one computer to another. This may not seem complicated, but consider:

• We may need to find a communications path to the other computer (routing).
• If many computers need the same communications channel, it may become overloaded (congestion).
• Two computers may use a single-computer channel at the same time (a collision).
• It would be helpful if we could turn a single channel into multiple virtual channels (multiplexing).
• We need standardized ways to format information so that all possible recipients can understand it (protocols).
• We may wish to have an interchange of data that lasts longer than a single message, with data flowing both ways (a session); we need standard ways to establish, maintain, and terminate these.
• Connections may be unreliable. We might need to determine whether a message was received (acknowledgement), determine whether it was received correctly (error detection), and, if not, fix it (error correction).
• We need standardized ways for applications to access network resources (APIs).
• We may wish to keep transmitted data secret (encryption).
• We may need to prove that the claimed sender of a message is actually the one that sent it (authentication).

Some terminology: A packet is a collection of data that travels together (or appears to) across a network. Sometimes we use the term segment to mean essentially the same thing.

We will use the term reliability. This has two meanings. First, it is the probability that some functionality will perform as desired. Second, it is the property of giving assurances of success. So functionality is reliable if it gives such assurances.

For example, the fundamental protocol of the Internet is IP. IP is not reliable. When a packet is sent via IP, there is no assurance that it is received. A protocol built on top of IP is TCP. TCP is reliable, despite the fact that it sends information via the unreliable IP protocol. TCP achieves this by allowing for acknowledgements of received segments, and retrying if no acknowledgement is received.

Note that the fact that IP is unreliable is not necessarily a bad thing. The decision was made to include reliability at the TCP level. Thus, IP does not need to be reliable; making it reliable would add needless complexity.

### The OSI Model

The OSI Model is a standard model of a network. It is divided into seven layers, with each layer dealing only with the layers immediately above and below it. Thus each layer presents an abstraction of the layers below it to the layers above it. This allows for layers to be altered without requiring a change in all network functionality.

For example, as long as we can do IP over some network, we can do TCP on top of the IP, no matter whether the network is actually wires, optical fiber, or a radio link.

The OSI Model is never completely implemented, but it provides a useful framework for understanding networking. Here are the seven layers, from low to high.

Physical
This is the wires, fiber, or whatever that carries the data.
This involves connections between physical networks.
Network
Machine-to-machine packets. IP is at this level.
Transport
User-to-user messages. TCP is roughly at this level.
Session
Conversations.
Presentation
Conversation as data in a recognizable form (not just bits).
Application
The interface to the application.

Introduction to Networking will be continued next time.

CS 321 Spring 2013: Lecture Notes for Monday, April 8, 2013 / Updated: 6 May 2013 / Glenn G. Chappell / ggchappell@alaska.edu