Unit 3 Flashcards

1
Q

What type of connections do ancient circuit-switched networks provide?

A

Persistent and dedicated connections

Typically priced per unit of time.

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

What type of connections do modern packet-switched networks provide?

A

Transient connections

Typically priced per unit of data.

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

What was ARPANET?

A

The first packet-switched computer network

Consisted of four computers located at UCLA, Stanford, UCSB, and Utah.

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

When was the first successful internet message sent?

A

October 29, 1969

The message sent was ‘LOGIN’ from UCLA to Stanford.

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

What allows the Internet to grow rapidly?

A

Open-network architecture

Each network can attach to the Internet without specific configurations.

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

What are the layers of the OSI model?

A
  • Application
  • Presentation
  • Session
  • Transport
  • Network
  • Data link
  • Physical
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does the physical layer in the OSI model do?

A

Moves data on physical connections

Uses various protocols like coaxial and CAT5/6.

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

What is the function of the data link layer?

A

Organizes bits into frames

Transmits bits across direct connections using protocols like Ethernet.

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

What is the role of the network layer?

A

Transmits bits across indirect connections

Uses protocols like Internet Protocol (IP).

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

What does the transport layer manage?

A

Organizes bits into packets

Responsible for flow control and reliability using protocols like TCP and UDP.

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

What is the IPv4 addressing scheme?

A

32-bit addresses typically written as 4 x 8-bit

Allows for ~4.3 billion addresses.

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

What is the purpose of the Domain Name System (DNS)?

A

Resolves hostnames into IP addresses

Establishes a set of name servers for this purpose.

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

How are IP addresses read?

A

Left-to-right with most-significant bits first

E.g., 141.161.20.3.

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

How are hostnames read?

A

Right-to-left with most-significant network name last

E.g., www.cs.georgetown.edu.

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

What do root name servers maintain?

A

The list of top-level domain (TLD) name servers

Governed strictly by ICANN.

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

What is the purpose of a hostfile?

A

Stores hostnames and IP addresses locally

Helps in remembering important IP addresses.

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

What is a switch in networking?

A

The central hub of a network

Routes traffic via MAC address.

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

What is the difference between a switch and a router?

A

Switches route traffic within a local network; routers connect to other networks

Routers establish reachability between networks.

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

What is the main problem that routing addresses?

A

Knowing the recipient’s IP address

Humans prefer to route by name rather than number.

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

What does the DNS query process involve?

A

Checks local hostfile, queries ISP, and may reach other routers

Reduces the number of queries to DNS name servers.

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

Fill in the blank: The Internet Protocol model has ______ layers.

A

Four layers

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

What is the significance of the first 8 bits in an IPv4 address?

A

Specifies the network (A-level)

There are newer versions allowing B-level and C-level specifications.

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

What are the examples of protocols at the transport layer?

A
  • TCP
  • UDP
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

True or False: The Internet Protocol (IP) was formalized in 1980.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What is the socket API?
A set of programming interfaces for establishing and managing network connections ## Footnote The socket API facilitates communication over networks by allowing programs to send and receive data.
26
What are server sockets used for?
Listening for incoming connection requests ## Footnote Server sockets accept connections from client sockets.
27
What are client sockets used for?
Connecting to server sockets ## Footnote Client sockets initiate communication with a server.
28
What does the OSI model consist of?
Application, Presentation, Session, Transport, Network, Datalink, Physical ## Footnote The OSI model is a conceptual framework used to understand network interactions.
29
Define a network socket.
One endpoint of a network connection ## Footnote A socket is an abstraction of a physical socket on a computer.
30
What is the Berkeley socket API?
A standardized interface for network sockets introduced in 1983 ## Footnote It became the de facto standard and later the POSIX standard.
31
List the operations a socket performs.
* Create * Bind * Connect * Send * Receive * Close ## Footnote These operations define how sockets interact over a network.
32
What are the two major types of sockets?
* UDP (datagram) sockets * TCP (session) sockets ## Footnote UDP sockets are connectionless and do not guarantee packet delivery, while TCP sockets are connection-oriented with guaranteed delivery.
33
How is a socket connection uniquely identified?
By the remote IP address and port number, and the local IP address and port number ## Footnote This ensures that each connection is distinct.
34
What is the range of port numbers?
0 – 65535 ## Footnote Ports are used to differentiate between different processes on the same computer.
35
What are system ports?
Ports in the range 0 – 1023, assigned for specific protocols ## Footnote Examples include ssh (22), smtp (25), and http (80).
36
What are reserved ports?
Ports in the range 1024 – 49515, assigned for requested protocols ## Footnote These ports are often used for program or company-specific protocols.
37
What are ephemeral ports?
Ports in the range 49516 – 65535, reserved for private or temporary use ## Footnote They are often used for short-lived connections.
38
What is the java.net package used for?
Implementing simple network applications ## Footnote It provides classes like InetAddress, Socket, and ServerSocket.
39
What does the java.net.ServerSocket class do?
Represents a listener for incoming connections on the server side ## Footnote It binds to a specific port and waits for client connection requests.
40
What does the java.net.Socket class represent?
A connection between a client and server ## Footnote It provides basic I/O streams to communicate with the other side.
41
What is a typical server-side setup in Java?
Creating a ServerSocket and accepting client connections ## Footnote Example: ServerSocket listener = new ServerSocket(30000); Socket client = listener.accept();
42
What must a server process provide for a client to connect?
* A known IP address * A known port number ## Footnote Clients connect to servers using these identifiers.
43
What is SocketException?
An exception related to network sockets that extends IOException ## Footnote It indicates issues with socket operations.
44
List some common SocketException subtypes.
* BindException * ConnectException * NoRouteToHostException * UnknownHostException ## Footnote These subtypes help identify specific network issues.
45
How do you read a line of text from a socket?
Using InputStream, InputStreamReader, and BufferedReader ## Footnote Example: BufferedReader sIn = new BufferedReader(new InputStreamReader(s.getInputStream())); String msg = sIn.readLine();
46
What does PrintWriter provide for socket communication?
The println() method for sending text over sockets ## Footnote It allows formatted output to the connected socket.
47
What is a DateServer?
A server that sends the current date to connected clients ## Footnote It listens for connections and responds with a datestamp.
48
What is a CapitalizeServer?
A server that capitalizes every letter in a String sent by clients ## Footnote It allows for persistent and interactive connections.
49
What is a challenge when handling multiple clients in a server?
The server must listen for new connections while interacting with existing clients ## Footnote This requires concurrent processing capabilities.
50
What is a program?
Instructions and data written and compiled/interpreted, stored on disk, and is a passive entity.
51
What is a process?
A program in execution that loads the program into memory, includes run-time data and resources, and is an active entity.
52
How does an operating system manage processes?
It manages process creation, allocates memory, and schedules processes.
53
What is process independence?
Process memory segments are separated and protected, preventing access to memory outside their segment.
54
What is concurrency in modern operating systems?
More processes running than CPU cores available, managed by a scheduler through time-sharing.
55
What is the main difference between processes and threads?
Processes are heavyweight, contain one or more threads, and have independent resources; threads are lightweight, share process memory, and are faster to create.
56
What are thread-local resources?
Every thread has its own program instruction counter, function call stack, and thread-local state information.
57
What does the Runnable interface require?
It requires the implementation of the run() method.
58
What is the purpose of the java.lang.Thread class?
To represent a thread of execution in Java.
59
What happens when a thread is started?
The thread executes its run() method.
60
What is a race condition?
A nondeterministic error where the system behavior depends on timing of thread execution.
61
How can data races be avoided?
By using an object monitor (lock) to ensure that only one thread can change a data value while another is using it.
62
What is a synchronized block in Java?
A block of code that requires a lock to be executed, ensuring that only one thread can access it at a time.
63
What is the purpose of semaphores?
To restrict access, allowing a finite number of threads to enter a critical section.
64
What are the states of a thread?
NEW, RUNNABLE, BLOCKED, WAITING, TIMED_WAITING, TERMINATED.
65
What is the role of the scheduler in thread management?
To decide which threads get CPU time and when, based on priority.
66
True or False: Threads in the same process can access any dynamic allocation.
True.
67
What is the priority range for Java threads?
1 to 10, with 10 being the highest priority.
68
Fill in the blank: A _______ is a nondeterministic error where the system behavior depends on timing.
race condition
69
What does the synchronized keyword do in Java?
It creates a lock on the method or block of code to prevent concurrent access.
70
What is the main advantage of implementing Runnable over extending Thread?
Allows separate inheritance and reusability.
71
What is a 'data race'?
A situation where one thread modifies a value that another thread is relying upon.
72
What does the 'wait-notify' mechanism do?
It allows threads to wait for a condition to be met or notify other threads when the condition changes.
73
What happens when a thread enters a synchronized block?
It attempts to acquire the lock associated with the object and is blocked until it does.
74
What is a semaphore?
A synchronization primitive that controls access to a resource through permits.
75
What are the basic behaviors of a semaphore?
Keep count of available permits, decrease when a thread takes a permit, increase when a thread returns a permit, block a thread when no permits are available.
76
What problem do threads solve?
They allow multiple operations to occur simultaneously.
77
What new problem do threads introduce?
Race conditions.
78
What is a race condition?
A situation where two or more threads can access shared data and try to change it at the same time.
79
What is the purpose of locks in multithreading?
To control execution of critical code sections and prevent race conditions.
80
What is deadlock?
A situation where two or more threads are blocked and cannot proceed without acquiring a resource.
81
What are the four conditions required for deadlock to occur?
* Mutual exclusion * Hold and wait * No preemption * Circular wait
82
What does mutual exclusion mean in the context of deadlock?
A required resource cannot be shared among threads.
83
What is hold and wait in the context of deadlock?
Threads hold allocated resources while waiting for others.
84
What does lack of preemption mean?
Resources held by threads must be released willingly; they cannot be forcibly taken.
85
What is circular wait?
A cycle of dependency where each thread needs a resource held by another thread.
86
How can deadlock be avoided?
By breaking any one of the four necessary conditions.
87
What is an example of breaking mutual exclusion?
Allowing simultaneous writes to files in Unix-like file systems.
88
How can preemption help in avoiding deadlock?
By allowing higher-priority tasks to take resources from lower-priority tasks.
89
What is a strategy to remove circular wait?
Number resources so that threads cannot request a higher-numbered resource until they have acquired all lower-numbered resources.
90
What does 'getting rid of hold-and-wait' imply?
Either use resources immediately or release them if waiting.
91
What is the wait-notify mechanism?
A message-passing system where threads wait for resources and are notified when they become available.
92
What role does a signaling object play in the wait-notify mechanism?
It coordinates the wait and notify actions between threads.
93
In the producer-consumer model, what do producers do?
Create resources and notify consumers when they are available.
94
What is an example of a common wait-notify scenario?
A dinner reservation where a patron waits for a table.
95
What is the BlockingQueue class used for?
To manage a queue with blocking behavior when adding or removing elements.
96
What happens when a thread calls wait()?
The thread enters a WAITING state until notified.
97
What is the difference between notify() and notifyAll()?
notify() wakes one waiting thread, while notifyAll() wakes all waiting threads.
98
What class in Java provides more flexibility than wait/notify?
The Lock class.
99
What methods do the Condition class provide?
* await() * signal()
100
What is the role of ReentrantLock in the BlockingQueue example?
It provides a locking mechanism for thread synchronization.