Supporting tech Flashcards

1
Q

What can a process be thought of?

A

Process = program in execution

Has:

  • Code that is executing
  • Data operated on
  • Execution state

Run on a single machine

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

What is included in execution state?

A
  • Register contents
  • PC
  • Call stack
  • etc,
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does a distributed application consist of?

A

Consists of processes running on different machines that communicate with each other via a network

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

What are threads?

A

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)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is meant bu a thread being a “unit of activity” alone?

A

As an example, it’s like the method/funtion call .

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

How does more than one thread(“unit of activity”) work in memory space.

Draw a diagram

A

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.

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

What are two core challenges that threads introduce?

A
  1. Understand the model of concurrency itself
    • new way of thinking
  2. Ensuring concurrent threads do not interfere with one another.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the definition of concurrency?

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

In general, how does a multi-process program start?

A

A single process program creates more processes

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

How are new processes created in a *nix system?

A

the fork system call. A literal clone of the current running process is created.

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

What does fork( ) return and why is it significant?

Provide a quick example of what the code looks like

A

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.

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

What is the code sequence you often see in a child process?

A

The child process then calls to execute a different program

This is done using an “exec” system call.

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

In general, write basic code that starts a new thread in Java.

A

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 } }

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

What is a race condition?

A

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.

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

What is the general server code for a Socket Stream?

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

What is the general Client Code for a Socket Stream?

A
17
Q

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

A
18
Q

What is the general client code for a Datagram Socket

A
19
Q

In general what is a RPC and what problem does it attempt to solve.

A

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

20
Q

In general, how does RPC work?

A

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
21
Q

In general what are two common approaches to RPC that deal with data translations to various machines?

A
  1. 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)
  2. 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)
22
Q

Explain how an RPC compiler works for C

A

The work is done in automatically generated stub programs

23
Q

In general what is RMI?

A

Remote method invocation

An abstration for remote method calling in Java

24
Q

What are the goals of RMI

A
  • Seamless
  • Natural (most java symantics)
  • Reliable
  • Safety (java run time environment)
25
Q

In general how does one use RMI?

What is needed on Client machine?

What is needed on Server machine?

A
  • The client needs to get a reference for the remote object
  • Then can call the methods in that object
  • The object itself must be a “remote class”
    • extends java.rmi.server.UnicastRemoteObject
    • implements a remote interface
      • public interface extends java.rmi.Remote
        • every method throws java.rmi.RemoteException
  • Client does not instantiate, it creates a remote interface type
26
Q

Exercise

Complete the Hello World RMI example from class

A
27
Q

What are the important characteristics of scripting languages?

A
  • Interpreted - easy to use and distribute
  • Weakly typed - manipulate any collections
  • Powerful - have special features
    • pattern matching and manipulation
  • Flexible and composable
    • rapid prototyping
    • portability (don’t need multipl executables)
  • Easy access to OS provided information
    • file contents
    • date
28
Q

What are the requirements for passing parameters using RMI?

A

The parameters need to be any of the following:

  • primitives
  • serializable (like Integer)
  • extend class remote
29
Q

What does interoperability include?

A
  • Communication protocol (such as IP address)
  • Data formats and translations for transmissions (like RPC)
  • Data access (databases Baybee)
30
Q

What are the two low-level standards for interoperability?

A
  • eXternal Data Representation (XDR)
  • Abstract Syntax Notation (ASN1)

These are used as encoding/decoding standards for different machines/OSs to communicate

31
Q

What is Service Oriented Architecture (SOA)

A

Ad-hoc distributed systems from pre-existing parts

Service-oriented architecture (SOA) is a style of software design where services are provided to the other components by application components, through a communication protocol over a network. The basic principles of service-oriented architecture are independent of vendors, products and technologies.[1] A service is a discrete unit of functionality that can be accessed remotely and acted upon and updated independently, such as retrieving a credit card statement online.

32
Q

Why is it not always desireable to allow remote DB access?

A
  • Difficult to control access
  • Interfaces can be seen as unfriendly
  • Trust and Authentication issues
33
Q

What is ODBC?

A

Open Data Base Connectivity

A standard for accessing any DB safely and remotely

34
Q

What is an ODBC driver?

A

Each DB vendor provides an “ODBC driver” which

  • Allows connections in a standard way
  • Accounts and permissions provided by the DB itself (so incredibly safe)
  • Results are sent back in a standard/readible way (by any machine)