CSCI 109
P vs NP
(P) Polynomial time, tractable (NP) There is no polynomial time algorithm to solve the problem Three types of problems: P, NP, not yet known if P or NP All problems in P are in NP
Digital Subscriber Line (DSL)
Connects LANs to ISPs through a dedicated line to the central office, which then redirects it to the ISP
The Church-Turing Thesis
Turing machines are capable of solving any effectively solvable algorithmic problem
Kernel
Core of the OS, copied from disk into RAM upon boot up Coordinates other programs Runs until another program is executed
Ethernet Technology
Used in every LAN - Twisted pair - Optical fiber - Wifi - Power Lines
CPU cycle
Fetch instruction, decode instruction, execute instruction
Kruskal's algorithm
Find MST Order edges in ascending order of cost, choose from the smallest edges so that no cycles are formed Greedy algorithm
Prim's algorithm
Find MST Start with one vertex, grow tree on min weight edge from all vertices So out of all reachable edges that don't cause cycles, take the smallest Greedy algorithm
Depth First Traversal (DFS)
Go through all vertices, good for finding a solution. Exhausts the subsequent vertices from a single vertex, then goes on to the next.
Breadth First Traversal (BFS)
Go through all vertices, level by level, good for finding the best solution
Cache
In between RAM and registers, concerning size and speed Volatile, holds information likely to be used soon
Locality principle in cache
Spatial locality- items near others that have been used recently Temporal locality- stores recently accessed items
Internet Edge
- Access networks connects hosts to the network - Access networks connects to networks in the core (ISPs)
Best First Search
- CLOSED and OPEN arrays - Add start to open - Remove node from OPEN and place it on CLOSED - Add children to OPEN and sort based on the heuristics - While you haven't found the goal node, pick the lowest heuristic node from open - If found, trace back from closed
A* search
- Calculate f = g + h - g is the cost associated with an edge - h is the admissible heuristic value for a given node - choose the node with the lowest f value
State of a robot
- Can be known, unknown or partially known by the robot - Can be discrete or continuous - Can be internal or external -> robot's state is a combination of both
Packet
- Chunks of user data - Meta-data: header that tells where the packet comes from and where it should go
Three Big Topics in AI
- DECIDE: Given a range of possibilities, decide which action to take (search over possibilities) - REASONING: Probabilistic models to describe situations - LEARNING: Improve prediction accuracy based on examples (data)
Digital Circuits and circuit switching
- Digital circuits: computer to computer connection - Circuit switched connections are dedicated between the source and the terminal - Humans are bad at time sharing
Internet structure
- End systems are connected to ISPs - In order for one end system to communicate to other end system, ISPs must be interconnected - IXPs: Internet exchange points, connect ISPs
Turing Machine
- FSM but with memory, in the case of the TM, memory is an infinite tape. - TM can move head to left or right, and also, read, erase or write a symbol in the given position.
Non effectively solvable problems (Undecidable Problems)
- Infinite number of problems that cannot be solved by the TM. E.g. halting problem - Requires a yes/no answer - No algorithm can accurately predict if a program will halt on arbitrary input
Access Networks
- Local Area Networks (LANs) - Host (desktops, laptops, servers) - Routers - Switches
FSM limitations
- Pigeonhole principle: If a FSM has n number of states, it will have problems solving a problem with n+1 symbols, as one state must be revisited and there is no way to know how many times it has been revisited - A FSM cannot count, therefore, problems like finding out if the numbers of As is the same as Bs or identifying palindromes are impossible.
Types of control in robots
- Reactive: reaction guided by sensors and world models, no "thinking" - Behavior-based: little reliance on internal representations, exhibits behavior based on its immediate environment - Deliberative: Calculation intensive, relies on internal representations - Hybrid control: mix of dependency on internal representations, and immediate environment
AI vs Machine Learning
AI is focused on actions, while Machine Learning is based on data.
Shakey the robot
Able to reason about its actions and develop a planning process based on human instructions
Algorithm vs. Program
Algorithm: abstract set of instructions to solve a problem Program: series of instructions written in precise syntax
Routers
Connect multiple LANs or LANs to WANs
Multitasking
CPU creates the illusion that multiple processes are running at the same time by dividing run-time into chunks and switching between programs fast
Cognitive Science
Cognitive Science is the interdisciplinary study of mind and intelligence in both natural and artificial systems
Packet Switching
Data is sent to switches that forward it to the terminal, remote switches, or even other local computers, allowing computer-to-computer communication without a direct connection.
Von Neummann Architecture
Deal with data and instructions concurrently, making computation more versatile and efficient Made up by the Controllers, ALU and registers.
Networking Layers
End system needs to interact with the server, how does that work? Answer: Networking layers - User makes request through API - API will go through a series of protocols, navigating through the various layers of ISPs, IXPs, between the user and the server - Retrieves information and makes its way back - We don't need to worry about how the API fetches information from the server
Heuristics
Estimate of how close you are to a goal - Admissible: never overestimates distance to a goal - Inadmissible: may overestimate
Dealing with fragmentation
Indirection: assigns physical memory to logical memory. Programs use logical memory which is then translated into physical memory. Virtual memory: concept of demand paging, memory is allocated for tasks that need to be done immediately. Memory that hasn't been used recently or isn't needed is moved to the disk, makes the RAM look bigger. Virtualization
Turing Test
Intelligence test, if a computer can behave indistinguishably from a human
World Models in Robotics
Internal state can be used to remember information about the world
Portability of an OS
Its ability to run on other machines and types of hardware
Network Core
LANs/WAN connections to ISPs, and ISPs to ISPs
Compiling process
Lexical Analysis - Identify logical pieces of description Syntax Analysis - How the pieces relate to each other Semantic Analysis - Meaning of overall structure IR Generation - Design one possible structure IR Optimization - Simplify structure Generation - Generate Structure Optimization - Optimize Structure
Machine dependent vs independent processes in compiling
Lexical analysis, syntax analysis, semantic analysis, and IR Generation are machine independent IR Optimization, generation and optimization are machine dependent
high-level language
Machine code is impossible to write Assembly is very hard and doesn't scale HL Langs provide abstractions that make our lives easier
Finite state machines
Machines with a discrete amount of states that can be modeled mathematically. Designed to compute, solve problems but with limitations
Internet Core
Networks of networks (ISPs) connecting together
Kruskal's complexity
O(E*logE) Sort the list of edges (E*logE) Add edge to the tree (V*logV) E*logE + V*logV
Subset sum
O(N*2^n) List all possible subsets: 2^n Check if any of them is the solution (largest one will have n elements)
BFS and DFS Complexity
O(V) Both go through all vertices of a tree
Prim's complexity
O(V^2) V iterations (one for each vertex) Go through V options of minimal edge
Dijkstra's complexity
O(V^2) Worst case: each vertex is connected to all the others, check (V-1) vertices for each vertex V
Enumerate all permutations of n elements
O(n!)
Travelling salesman
O(n!) Whenever you visit a city you have one less option to visit next, hence the factorial complexity
Quicksort complexity
O(n*logn) Average depth of layers of 'sublists' = logn Go through n comparisons at each level
Selection sort complexity
O(n^2) Make n + n-1 + n-2 + ... + 1 comparisons. n*(n-1)/2 comparisons
Controllers
Part of CPU, reads instructions and directs them to the ALU, transfers data from one place to another, communicates with I/O devices.
Actuator
Part of the robot that acts like an engine, generating the energy needed to move and driving the effectors
Effectors
Parts of the robot that are driven by the actuators and allow the robot to move
(Networks) Communication Link
Physical connection between two devices, allowing for the transmission of data.
Quicksort
Pick a pivot, put everything smaller to the left and greater to the right. Repeat the process in the two resulting lists Call recursively until reach lists of size one and two. At that point join them
Cable Modem
Provides internet access in a manner similar to the DSL but uses a shared line, instead of a dedicated one.
Roles of an OS
Referee: enforces fair resource sharing Illusionist: makes sure that each program can run independently by providing the illusion that they have full access to all of the computer's resources and are the only program running at a time Glue: common services (copy and paste) Files read by any application UI routines
Storage hierarchy
Registers --> RAM --> Secondary Storage (Disk Space) Registers are small, fast and expensive, while secondary memory is large, slow and cheap
ALU
Responsible for performing all arithmetic calculations and making logic and comparison decisions
Tortoises
Robots invented by a random guy, they have light sensors and change route when encounters obstacles
Process scheduling policies
Round-robin: Every process gets an equal 'chunk of time', in circular manner. Potentially high latency, fair First-come, first-served: Fair, best policy, no risk of starvation Shortest remaining time: High latency, leads to starvation in processes that require lots of computation
Policies of an OS
Rules that enforce fair resource sharing, access to information, order of execution of tasks, etc.
(Networks) Host
Sends or receives data
Dijkstra's algorithm
Shortest path from one vertex to all the others Start with a vertex, calculate distance to immediate vertices, all others should be set to infinity As you go along, pick the vertices that have the lowest cost and see if any other vertices get relaxed (i.e. lower the cost)
Selection sort
Start at first index, find min and put it there Recursively call on next index
Memory
Storage is organized linearly, and it takes roughly the same time to access each memory address
Packet Switching Principle
Store and Forward: Receive package, store it, figure out where to send it.
Responsibilities of an OS, resources
Time-sharing the CPU: before OSs, the CPU could only execute one program at a time, making it very inefficient OS manages space, time, I/O Resource: some part of the computer that the OS uses E.g. I/O devices, memory, CPU
Compilers
Translates high-level language statements to assembly code statements Takes into account the machine that the code is being run on
Minimax algorithm
Uses a tree to keep track of possible positions and scores nodes based on the outcomes (assuming the opponent will always choose the lowest score node) - Example: Deep Blue computer, analyzes 40 branches at once
Volatile vs Non-volatile memory
Volatile is wiped when computer shuts down (RAM, Registers) Non-volatile is conserved (disk space)
Memory fragmentation
When a process is initialized, some chunk of memory is allocated to it When it finishes that chunk of memory is freed up and given back to the OS This process could lead to fragmentation, which is when you have a lot of separate portions of free memory
WAN
Wide Area Network -> connects LAN to network core
Time sharing in packet switching
With packet switching you can calculate the probability of the usage being more than the maximum supported, allowing for more efficient usage Contrast with circuit switching, which had to have a dedicated connection for each user.