computer_systems_notes
computer_systems_notes
Boolean expressions:
• AND – reflects true or false. P and Q – two different statements, both should be true.
• XOR – true is when one is true and other is false. Either P or Q but not both.
Memory types
Types of Gates:
AND Gate: Outputs true (1) only if both inputs are true.
OR Gate: Outputs true if at least one input is true.
NOT Gate: Outputs the opposite of the input (inverts the input).
XOR Gate: Outputs true if exactly one of the inputs is true.
Gates:
• Relays
• Gears
• Optic devices
Universal gates – NOR (NOT OR), NAND (NOT AND)
Flip flops
A flip-flop is a fundamental unit of computer memory.
Case 2:
+-------+-------+
| Cell 5 | Cell 6 |
Each cell has its address. But data can be accessed in any order. +-------+-------+
| 8 | 8 |
+-------+-------+
Representing text
ASCII uses bit patterns of 7 to represent the upper and lowercase letters of the English alphabet, punctuation
symbols, the digits 0 through 9, and certain control information such as line feeds, carriage returns,
and tabs.
ISO
Created number extensions for ASCII.
Issues:
• Symbols are not enough to represent Asian, Eastern European Languages.
• Initial document was in only one standard.
Solution:
• Unicode
○ Uses a unique pattern of up to 21 bits to represent each symbol.
Text file:
• A file containing long sequences encoded in ASCII.
Images
Pixels
Entire image is represented in a bitmap.
Disadvantage:
• an image cannot be rescaled easily to any arbitrary size.
This system uses a fixed number of bits to represent each of the values in the system. Each value is represented in size of
32 bits.
The leftmost bit represents sign. It is a sign bit. Negative values have sign bit of 1 and positive values - 0.
There's convenient relationship between patterns of negative and positive values. The complement of a pattern is the
pattern obtained by changing all the 0s to 1s and all the 1s to 0s; 0110 and 1001 are complements.
Overflow problem
Excess Notation
each of the values in an excess notation system is represented by a bit pattern of the same length.
Storing integers with fractional part requires to When there's not enough space to copy value to the
store both integer and its radix point - > Floating Mantissa field, and the rightmost bit is lost.
point notation.
Solutions:
Floating point notation Longer mantissa field, nowadays 32 bits- > more space.
8 -1 = 7
Another reason:
Some values cannot be accurately expressed. In binary,
There are more nonterminating values than in decimal notation.
01101011 Solution:
Manipulate data in units of pennies so that all values are integers that can
.1011 Be accurately stored using method such as two's complement.
Python is an interpreted language, which for beginners means that Python instructions can be typed
into an interactive prompt, or can be stored in a plain text file (called a “script”) and run later.
What is output?
a result of the program that will be made visible to the user.
Variables
In script, the first line is an assignment statement. Python is a dynamically typed language, which
means that our script need not establish ahead of time that there will be a variable called message,
orwhat type of value should be stored in message.
Rules in Python:
Variable must begin with an alphabetic character
Name may consist of an arbitrary number of letters, digits, and the underscore character, _.
Python variable names are case-sensitive, meaning that capitalization matters.
A small number of keywords, names that are reserved for special meaning in Python, cannot be used
as variable names.
Machine prepared for a task - task was executed - all tapes retrieved.
This is a batch processing - the execution of jobs by collecting them in a one batch and then executing
them without further interaction of the user.
Jobs were collected into a job queue, first in first out. Objects removed in an order they were received.
Interactive processing
Problem - real time processing could process only one user, not multiple users.
Solution - multiprogramming - OS that can process multiple users at the same time.
Time is divided into intervals and then the execution of each job is restricted to only one interval at a
time.
At the end of each interval, the current job is temporarily set aside and another is allowed to execute
during the next interval.
Software classification
Application software
Programs for performing tasks particular to machine's utilization. Examples -
spreadsheets, database systems, desktop publishing systems, accounting
systems, program development software, and games.
System software
performs those tasks that are common to computer systems in general.
the system software provides the infrastructure that the application software requires.
Utility software consists of software units that extend (or perhaps customize) the capabilities of the operating system.
Operating system:
User interface - OS communicates with users. Examples of user interface - shell, GUI.
Graphical User Interface - GUI - files and programs, are represented pictorially on the display as icons. Allows to
perform commands.
GUI shell - Windows manager - Windows - allocates blocks of space on the screen.
Kernel components:
File manager - the file manager maintains records of all the files stored in mass storage, including where each file is
located, which users are allowed to access the various files, and which portions of mass storage are available for new
files or extensions to existing files.
Device drivers - the software units that communicate with the controllers (or at times, directly with peripheral devices)
to carry out operations on the peripheral devices attached to the machine. Through device drivers we can manipulate,
Memory manager - coordinates machine's use of the memory. The memory manager must find and assign memory
space for these needs and ensure that the actions of each program are restricted to the program’s allocated space.
Memory manager also creates virtual memory by paging when memory is not enough.
Scheduler -
• maintains a record of the processes present in the computer system,
• introduces new processes to this pool
• removes completed processes from the pool.
• Creates a new entry in a process table
• Keeps track of all processes
Dispatcher -
• Oversees the execution of process. Done by multiprogramming.
It is this procedure that transfers the operating system from mass storage (where it is permanently
stored) into main memory (which is essentially empty when the machine is first turned on).
When computer is turned off, main memory is erased as it is volatile. Part of memory is transferred
to ROM, where contents can be only read and not changed.
Boot loader:
Permanently stored in ROM. Executed when computer is turned on. Directs CPU to transfer OS from
the predetermined location in volatile memory. Once OS is in volatile memory, boot loader directs
CPU to perform jump to that area of the memory.
When such a machine is first turned on, the boot loader loads and activates the operating system.
Includes:
• Current position in the program
• Values in the other CPU registers
• Associated memory cells.
Process administration
Scheduler maintains blocks of info in the main memory by process table.
Process table contains info about memory area, priority in the process, process status (waiting //
ready).
Process statuses:
• Ready - process can be continued.
• Waiting - progress currently delayed until external event occurs.
Dispatcher oversees process of scheduled processes -- > divides tasks into time slots and switches
contexts.
Dispatcher initiates timer circuit which generates a signal at the end. This is an interrupt signal.
Interrupt signals
Interrupt handler is a part of dispatcher and describes how dispatcher should react to interrupt
signal.
Function of the interrupt signal - to stop the current process and take control back to the dispatcher.
Dispatcher selects process according to its priority, restarts timer and allows to begin the selected
process.
Multiprogramming allows to stop and restart the process later. This way - increases efficiency of the
machine.
Functions:
• The file manager allocates access to files and allocates mass storage space for the construction of new files
• The memory manager allocates memory space.
• The scheduler allocates space in the process table
• The dispatcher allocates time slices
Semaphores
Operating system must keep track of whether device is available (0) or not (1).
Solutions:
• processes of setting flags and allocating should be not interrupted.
• Test and set system - This instruction directs the CPU to retrieve the value of a flag, note the value received, and
then set the flag—all within a single machine instruction. Process is not recognized by interrupt signals, everything
is done in one operation.
There should be only one process executed at the time in the critical region - mutual exclusion.
Deadlock
two or more processes are blocked from progressing because each is waiting for a resource that is
allocated to another.
Solutions?
The operating system would make the nonshareable resource appear shareable by creating the illusion
of more than one printer. This technique of holding data for output at a later but more convenient time
is called spooling. (Printer example)
Network:
• PAN - personal area network, less than a few meters
• LAN - local area network
• WAN - wide area network
Network:
CSMA / CD
Devices:
• Bridges - connect two busses, does not necessarily pass all the messages. Looks at the
destination address that accompanies each message and forwards a message across the
connection only when that message is destined for a computer on the other side.
• Switches - bridge with multiple connections, connects several busses.
• Repeater - passes signals between the buses.
Print server - early application of client / server model. Printer was used as a server and made connection
available for all the machines in the network.
File server - machine which contained all the records was a server, other machines - clients.
Peer to peer -
Cluster computing - A distributed system in which many independent computers work closely
together to provide computation or services comparable to a much larger machine.
Provides high availability - because it is more likely that at least one member of the cluster will be
able to answer
a request, even if other cluster members break down or are unavailable. At least one is available.
Load balansing - load is balanced equally, reduced from members who have too much to members
who have too little.
Grid computing - distributed systems that are more loosely coupled than clusters but that still work
together to accomplish large tasks.
Cloud computing -- cloud -- google Drive, google Apps, Amazon Elastic Cloud.
A bridge connects two network segments and transfers messages to a specific destination based on
the MAC address. A switch, on the other hand, acts as a multi-port bridge, connecting multiple
devices and allowing direct communication between them.
What is a router?
Router is a device which connects several networks into one network, and directs data packets
between them. and allows the internet connection between them. Router is a gateway from the
network to the internet.
Salesman and customer ---> customer buys service, salesman provides that service to the customer.
Everyone speaks by one. You should wait for other person to finish talking to start talking.
You should wait for your place in queue. You cannot step over the other person.
Cluster Computing: Computers are tightly connected, typically within the same network or location,
working together as a unified system. It provides high performance by leveraging the combined
resources of the machines in a controlled, often homogeneous environment.
Grid Computing: Computers are more loosely connected and can be spread across different
geographical locations. It involves pooling resources from diverse systems to perform large-scale
tasks. Grid computing is more flexible and can be accessed by different organizations or individuals,
often using public or private networks.
Internet architecture
Internet addressing
Internet Corporation for Assigned Names and Numbers (ICANN) - a nonprofit corporation established
to coordinate the Internet’s operation.
DNS - The Domain Name System (DNS) is a hierarchical and distributed name service that provides a
naming system for computers, services, and other resources on the Internet or other Internet Protocol
(IP) networks.
Application layer client/server protocol that enables servers and clients to exchange news articles in
a manner similar to SMTP for emails.
File Transfer Protocol (FTP) - application for moving files among computers.
Protocols
So SMTP is used when sending emails, POP3 and IMAP are used when receiving emails.
POP3 downloads emails to the computer.
IMAP - > for retrieving emails, allows to view emails from multiple devices, keeps copies and
synchronizes.
Multimedia streaming -
unicast refers to one sender sending messages to one receiver,
whereas N-unicast refers to a single sender involved with multiple unicasts.
Similar to streaming
Anycast - one of the nearest association. Anycast enables to connect to the nearest server.
Content delivery networks CDN - groups of servers distributed strategically around the Internet that
specialize in streaming copies of content to nearby end users in their network “neighborhood”.
Questions
What is the purpose of tier-1 and tier-2 ISPs? What is the purpose of access ISPs?
Tier 1 and tier 2 provide the internet service. Tier 1 is a backbone of the internet.
Access ISP provides internet access to the hosts for a charge. Link between tier 1/2 and users.
Tier 1 ISPs
• Purpose: Tier 1 ISPs form the backbone of the internet by interconnecting and providing global
internet access. They typically have peering agreements with other Tier 1 ISPs, which means
they exchange traffic without paying each other.
• Customers: Other ISPs (Tier 2 or lower), large organizations, or governments.
What is DNS?
DNS is domain naming service. Using this system, name to domain is provided. Translates domain
names to IP addresses which computers can use for a communication.
In what way is the structure of a mnemonic address of a computer on the Internet (such as
overthruster.propulsion.
yoyodyne.com) similar to a traditional postal address? Does this same structure occur in IP
addresses?
Traditional post address also has a street and house noted next to the post code and country, same
as ip address has subdomains.
Name three types of servers found on the Internet and tell what each does
Types of servers - DNS servers, FTP servers, mail servers. DNS servers translates domain name to IP
address, FTP servers are beneficial for file transfer, mail servers - send, receive, store email
messages.
In what way do the P2P and multicast approaches to Internet radio broadcast differ from N-
unicast?
N unicast is one way, information is shared only with the recipient, multicast allows to share
information with multiple hosts. N unicast sends the information to each host separately.Multicast
and P2P only when needed.
N-unicast: Inefficient for large audiences due to separate streams for each user.
Multicast: Efficient for large audiences but depends on network support.
P2P: Highly scalable and efficient as peers share the distribution load.
What criteria should one consider when choosing one of the four types of VoIP?
Software packages:
• Browsers:
○ Resides on the computer
○ Charges with tasks of obtaining materials requested by the user.
• Web servers
○ Resides on the computer containing hypertext documents
○ Provides access to the documents under its control by browser.
○ Apache, Nginx
URL
A unique address to access a website.
HTML
XML
Created to represent:
• Mathematics
• Multimedia presentations
• Music
HTML is based on XML, but focus more on semantics rather than appearance itself.
Security
In HTML problems:
- > ingredients as list, in XML - could be used with <ingredient></ingredient> tags.
• It has
Semantic a risk of-malicious
approach activities.
search engines.
• Clients
Client can
side and causeside
server programs to be executed.
Main task - to provide the INFRASTRUCTURE required to pass messages between machines.
1. Application layer
2. Transport layer
a. Divides messages in order to prevent obstruction of flow of other messages.
b. Segments are packets.
c. Packets are treated as individual messages.
d. Assigns ports
3. Network layer
a. Decides where messages should be sent
4. Link layer
TCP vs UDP:
UDP - Transport layer does not establish connection, differently from TCP.
UDP - just sends a message without establishing a connection. Does not retransmission.
TCP - TCP transport layers at the origin and destination work together by means of acknowledgments
and packet retransmissions to assure that all segments of a message are successfully transferred to the
destination.
TCP has:
• Flow control -> less efficient, reduces the transmitting speed
• Congestion control -> adjusts message's transmission speed at TCP origin destination.
Transport layer based on UDP - more effective, is more streamlined than a layer based on TCP.
IP
the first statement in our routine, which selects the first entry in the list as the test entry, is based on the assumption
that the list in question contains at least one entry.
Sequential order - > entries are in sequential order, linear search. Used for short lists. Disadvantage -> long lists are not
as efficient.
Loops
VS
But we cannot produce a similar sequence that is equivalent to the loop structure, because we don't know how many
drops we need.
Flowchart
We search in an area where value could be located. We are searching in the middle of the list.
Recursion - Whereas the sequential search involves a circular form of repetition, the binary search
executes each stage of the repetition as a subtask of the previous stage
Recursive function is mainly for testing. It is created to test for the termination condition.
Algorithm efficiency