Unit 3 Flashcards

(38 cards)

1
Q

What are the 4 intra-network layers?

A

Physical layer
Data link layer
Network layer
Transport layer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Describe the physical layer (intra-network)

A
  • Service
    – Move data on physical connections
  • Interface
    – Send the bits provided
  • Protocols
    – Many (voltages, pinouts, timings,
    frequencies, etc)
  • Examples
    – Coaxial, CAT5/6, radio waves
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe the data link layer (intra-network)

A
  • Service
    – Organize bits into frames
    – Transmit bits across direct connections
  • Interface
    – Send bits to another machine
  • Protocols
    – Media Access Control (MAC)
  • Examples
    – Ethernet, 80.11 standards
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe the network layer (intra-network)

A
  • Service
    – Transmit bits across indirect
    connections
  • I.e., to machines not directly connected
  • Interface
    – Send bits to a specified address
  • Protocols
    – Global addressing and routing
  • Examples
    – Internet Protocol (IP)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe the transport layer (intra-network)

A
  • Service
    – Organize bits into packets
    – Send bits between hosts
  • Interface
    – Send bits to a host
  • Protocols
    – Flow control, congestion management,
    reliability
  • Examples
    – TCP and UDP
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which intra-network layer(s) acknowledge every machine in the network?

A

physical layer, data link layer, network layer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which intra-network layer(s) abstract to their host?

A

Transport layer: the endpoints of a communication; the route (and intermediaries) used to connect hosts are invisible above this level

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Describe the session layer

A
  • Service
    – Open, maintain, and close connections
  • Interface
    – Open, send, receive, close
  • Protocols
    – Naming, organizing, mux/unmux
  • Examples
    – Berkeley sockets, SOCKS
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Describe the presentation layer

A
  • Service
    – Format data for transmission
  • Interface
    – Send this data over the network
  • Protocols
    – Encodings, endianness, encryption
  • Examples
    – ASCII, Unicode, JSON
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a Switch?

A

A switch is the central hub of network
Switches rout traffic via MAC address

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a router and what does it do?

A

A network’s out-facing connection to other networks
Routers interact with routers on other networks
- they interact with the routers they have direct physical connections to
- routers communicate to establish reachability (they know and share the addresses contained in their network, they learn and share the addresses on networks they connect to directly, they propagate addresses they can reach indirectly)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

True or False: In OOP languages, sockets are almost always classes

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a network socket?

A

An abstraction of a physical socket on a computer
A data object representing that connection; each side of a network connection has a local socket object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

True or False: sockets implement the transport layer and use the session layer

A

False
Sockets implement the session layer, so they use the transport layer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which two types of data are used by socket connections?

A

Network address (IP) of a machine
The port number of a particular machine

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are socket connections uniquely identified by?

A

The remote IP address and the remote port number
The local IP address and the local port number

17
Q

What is a port number used for?

A

An IP address identifies a single computer but there may be multiple processes using network traffic on that computer
Port number is used to divide traffic within a single computer

18
Q

What is the socket communication pattern?

A

Establish a connection: server listens/waits for incoming connection requests, the client connects to the server
Communicate: server and client speak/listen according to established protocol
End a connection: both server and client close socket

19
Q

What does java.net.ServerSocket do?

A
  • Used in server-side applications
    – Established before any active
    connection
  • Represents a listener
    – Binds to a specific port
    – Awaits connection requests and accepts them
  • Produces a Socket when connection is established
    – Used from that point onward to interact with client
20
Q

What does java.net.Socket do?

A
  • Used in server-side and client-side
    applications
  • Represents a connection
    – The local endpoint of the
    communication
  • Provides basic I/O to the other side
    – A (byte) InputStream
    – A (byte) OutputStream
21
Q

What are the subtypes of SocketException?

A

BindException : the port you asked for is unavailable
ConnectException : the hostname/port specified didn’t respond
NoRouteToHostException : routing to the machine itself failed
UnkownHostException : a failure of DNS resolution on your String hostname

22
Q

Differences between a program and a process

A

Program
* Instructions and data
– Written and compiled/interpreted
– Stored on disk
* A passive entity
– Running a program requires creating a
process
* Can be associated with multiple
processes

Process
* “Program in execution”
– Loads program into memory to execute
– Includes run-time data and resources
* An active entity
– Carrying out instructions
– Interacting with data
* Associated with a single program
– Instructions copied into process memory

23
Q

What does a scheduler do?

A

Manages time-sharing between processes

24
Q

Process to process communication is…

A

restricted to explicit message passing; requires system level resources and involvement
Significantly slower than direct memory access

25
What should you do if two tasks are closely related?
"Combine" the processes - A single shard pool of memory for both tasks (no explicit messages) - Allows for faster start-ups/shut-down (common resource allocations)
26
Processes vs Threads
Process * Contains one or more threads * Process-level resources are independent – Not shared with other processes – Protected from other processes * Heavyweight – Slow to create and start Thread * Contained in exactly one process * Common resources – Shared (process) memory pool – Not protected from other threads * Lightweight – Faster to create and start, since no additional process resources are needed
27
What is the java abstraction that represents a thread of execution?
java.lang.Thread
28
True or False: The first ('main') thread is not created automatically
False The first ('main') thread is created automatically
29
What is a race condition?
A nondeterministic error The system behavior/outcome depends on timing, but some orders of execution produce bad outcomes
30
What is a data race?
A common race condition One thread modifies a value that another thread is relying upon The state of the value/memory depends on the timing of the execution (and some are invalid)
31
Describe Java synchronized blocks
State an object to synchronize on; this object "owns" the lock Whan a thread reaches a synchronized block it attempts to get the lock and is blocked until it does, receives the lock until the block is done and returns the lock when leaving
32
What are semaphores?
A "multi-lock" which restricts access but allows more than one thread to enter Keeps count of available permits: decreases each time a thread takes a permit and increases each time a thread returns a permit Block a thread when no permits are currently available
33
What are the 4 conditions that must exist for deadlock to be possible?
Mutual exclusion Partial allocation Lack of preemption Circular wait
34
What is Mutual Exclusion?
* A required resource that cannot be shared – Hardware (e.g., printers) – Files (or pipes) – Object monitors * No exclusion means no blocking – ... but could cause race conditions!
35
What is Partial Allocation?
* Also called “hold and wait” * Threads keep (“hold”) resources they acquire while they wait for others – No other thread can use the held resource – ... but this thread isn’t using it either!
36
What is Lack of Preemption?
* Resources held by threads must be willingly released – They cannot be taking involuntarily * Preemption would let threads “steal” resources from others – E.g., CPU scheduler
37
What is Circular Wait?
* A “cycle of dependency” – Might be a 2-cycle; might be longer – Each thread needs something the thread ahead has – Each has something the thread behind needs * If any thread can do work – It does its work and finishes – It releases held resources (and situation simplifies)
38
What is "Wait-notify"?
A massage passing system between threads Threads that need a resource (or consume it) wait for the resource to become available Threads that have a resource (or produce it) notify waiting threads when they are available Key feature: while you wait, you release all your locks