Supporting tech Flashcards
What can a process be thought of?
Process = program in execution
Has:
- Code that is executing
- Data operated on
- Execution state
Run on a single machine
What is included in execution state?
- Register contents
- PC
- Call stack
- etc,
What does a distributed application consist of?
Consists of processes running on different machines that communicate with each other via a network
What are threads?
Threads are cheaper alternatives to processes
- commonly referred to as “lightwight processes”
May be though of as a memory space (contained code and data) together with a single thread.
- It executes the sequential code that manipulates the process’ data (sharing data with process)
What is meant bu a thread being a “unit of activity” alone?
As an example, it’s like the method/funtion call .

How does more than one thread(“unit of activity”) work in memory space.
Draw a diagram
The memory space is shared among the cooperating, concurrent threads.
The memory space still contains a program (muli-threaded now) and the data it operates on.

What are two core challenges that threads introduce?
- Understand the model of concurrency itself
- new way of thinking
- Ensuring concurrent threads do not interfere with one another.
What is the definition of concurrency?

In general, how does a multi-process program start?
A single process program creates more processes
How are new processes created in a *nix system?
the fork system call. A literal clone of the current running process is created.
What does fork( ) return and why is it significant?
Provide a quick example of what the code looks like
It returns either 0 or the process id (pid) of the child we created.
0 = we are the parent
!0 = we are a child
With this pid difference, everything else is the same.

What is the code sequence you often see in a child process?
The child process then calls to execute a different program
This is done using an “exec” system call.

In general, write basic code that starts a new thread in Java.
public class main { public static void main(String[] args){ Thread thread1 = new MyThread(); thread1.go(); } } public class MyThread implements runnable { private Thread me; public MyThread(){ //constructor } public run(){ //we are off and running in a new thread } public go(){ me = new Thread(self); me.start();//pops over to run } }
What is a race condition?
If we have two threads running that can both access and modify the same variable X (a bank balance) then different results may be seen deperending on the order of accesses to X
The end result depends on which programs get to the data first.
What is the general server code for a Socket Stream?

What is the general Client Code for a Socket Stream?

In general what is the server code for a Datagram Socket?

What is the general client code for a Datagram Socket

In general what is a RPC and what problem does it attempt to solve.
Remote Procedure Call is a way to call a method (with parameters) on a remote machine.
The problem is solves is that a remote machine is not sharing the same memory and stack as the calling client machine. So how do we abstract away the passing on messages with these variables to call the remote methods

In general, how does RPC work?
RPC software translates procedure calls into message passing using marshalling and de-marshalling.
- Takes data, serializes it, sends and de-serializes it on the other side
Problem:
- Passings information between different machines
- data sizes
- encodings
- endians
In general what are two common approaches to RPC that deal with data translations to various machines?
- Wire/Network format
- Everything is converted to on specific format before sent
- Each machine translates from standard format to their specific format upon reciept
- (Overhead, as translation not needed when sending to same machine types)
- Each machine translates from standard format to their specific format upon reciept
- Everything is converted to on specific format before sent
- Cross-Bar
- The type of machine content is being sent to is known and converted to that specific format before sent
- (More complicated but more efficient)
- The type of machine content is being sent to is known and converted to that specific format before sent
Explain how an RPC compiler works for C
The work is done in automatically generated stub programs

In general what is RMI?
Remote method invocation
An abstration for remote method calling in Java
What are the goals of RMI
- Seamless
- Natural (most java symantics)
- Reliable
- Safety (java run time environment)