Computer and Networks - Unit 4

Requirements

Work through College Board Unit 4… blog, add definitions, and pictures. Be creative, for instance make a story of Computing and Networks that is related to your PBL experiences this year.

How a Computer Works

As we have learned, a computer needs aa program to do something smart. The sequence of a program initiates a series of actions with the computers Central Processing Unit (CPU). This component is essentially a binary machine focussing on program instructions provided. The CPU retrieives and stores the data it acts upon in Random Access Memory (RAM). Between the CPU, RAM, and Storage Devices a computer can work with many programs and large amounts of data.

List specification of your Computer, or Computers if working as Pair/Trio

Define or describe usage of Computer using Computer Programs. Pictures are preferred over a lot of text. Use your experience.

The Internet

Watch/review College Board Daily Video for 4.1.1

Watch/review College Board Daily Video 4.1.2

  1. TRUE: Open standards and protocols enable different manufacturers and developers to build hardware and software that can communicate with hardware and software on the rest of the internet.
  2. FALSE: IETF is a task force used to enforce laws to keep manufacturers out of the internet.
  3. FALSE: Routes are determined in advance and are not flexible.
  4. TRUE: A protocol is an agreed-upon set of rules that specify the behavior of a system.
  5. FALSE: UDP guarantees transfers and is faster.
  6. FALSE: The World Wide Web is the internet.
  7. TRUE: HTTP is a protocol used by the World Wide Web.
    • Essential Knowledge
    • The internet is a computer network consisting of interconnected networks that use standardized, open (nonproprierary) communication protocols.
    • Access to the internet depends on the ability to connect a computing device to an internet connected device.
    • A protocol is an agreed-upon set of rules that specify the behavior of a system.
    • The protocols used in the internet are open, which allows users to easily connect additional computing devices to the internet.
    • Routing on the internet is usually dynamic; it is not specified in advance
    • The scalability of a system is the capacity for the system to change in size and scale to meet new demands.
    • The internet was designed to be scalable
    • Information is passed through the internet as a data stream. Data streams contain chunks of data, which are encapsulated in packets.

     User Machine  <---> Frontend Server <---> Backend Server
    +-----------+         +-----------+         +-----------+
    |  Browser  |         |  GH Page  |         |   Flask   |
    +-----------+    ^    +-----------+    ^    +-----------+
    |    HTTP   |    |    |    HTTP   |    |    |    HTTP   |
    +-----------+    |    +-----------+    |    +-----------+
    |    TCP    |    |    |    TCP    |    |    |    TCP    |   
    +-----------+    |    +-----------+    |    +-----------+
    |     IP    |    V    |     IP    |    V    |     IP    |
    +-----------+         +-----------+         +-----------+
    |  Network  |  <--->  |  Network  |  <--->  |  Network  |
    +-----------+         +-----------+         +-----------+

The “http” layer is an application layer protocol in the TCP/IP stack, used for communication between web browsers and web servers. It is the protocol used for transmitting data over the World Wide Web.

The “transport” layer (TCP) is responsible for providing reliable data transfer between applications running on different hosts. The TCP protocol segments the data into smaller chunks called “segments”. Each segment contains a sequence number that identifies its position in the original stream of data, as well as other control information such as source and destination port numbers, and checksums for error detection.

The “ip” layer is responsible for packetizing data received from the TCP layer of the protocol stack, and then encapsulating the data into IP packets. The IP packets are then sent to the lower layers of the protocol stack for transmission over the network.

The “network” layer is responsible for routing data packets between networks using the Internet Protocol (IP). This layer handles tasks such as packet addressing and routing, fragmentation and reassembly, and network congestion control.

Fault Tolerance

Watch both Daily videos for 4.2

The network activity was a very good method of practice to analyzing certain networks with tens of routes and checking whether or not they are fault-tolerant. Essentially, fault tolerance means that in a network of many different sources and destinations, if one route goes down, there is still redundancy and the network has an ability to go from the original source to destination. There is not only one path from A to B, so if that one path goes down, there are more routes that A can go through to eventually reach B.

Parallel and Distributed Computing

Review previous lecture on Parallel Computing and watch Daily vidoe 4.3. Think of ways to make something in you team project to utilize Cores more effectively. Here are some thoughts to add to your story of Computers and Networks…

What mainly catches my eye here as an option for parallel computing within the server is the “workers” parameter. The workers are the number of processes actually loading the application, so if there are multiple workers, there can be multiple processes loading the app in a parallel fashion. According to the article, something that I did not notice as a parallel computing process is the number of threads. This is a parameter that is not a part of the above command, but can be added.

Last week we discussed parallel computing on local machine. There are many options. Here is something to get parallel computing work with a tool called Ray.

  • Review this article… Can you get parallel code on images to work more effectively? I have not tried Ray.

After reading the article, it seems as if Ray is an application that is very useful for very large objects and running them efficiently in the form of parallel computing. It is imported as a separate python module, and when testing the running of certain programs, the processing time was significantly less (albeit for the programs tested in the article, it was a very minimal difference of 2-3 seconds), but can be much more significant if being compared for larger data sets in programs.

import ray

# define a simple function that takes a number and returns its square
def square(x):
    return x * x

# initialize Ray
ray.init()

# create a remote function that squares a list of numbers in parallel
@ray.remote
def square_list(nums):
    return [square(num) for num in nums]

# define a list of numbers to square
nums = [1, 2, 3, 4, 5]

# split the list into two parts
split_idx = len(nums) // 2
part1, part2 = nums[:split_idx], nums[split_idx:]

# call the remote function in parallel on the two parts
part1_result = square_list.remote(part1)
part2_result = square_list.remote(part2)

# get the results and combine them
result = ray.get(part1_result) + ray.get(part2_result)

# print the result
print(result)