Transcript document

CS120: Lecture 7
MP Johnson
Hunter
[email protected]
1
Agenda
• OSs: processes
• networks
– Basics, def
– Internet/web
– Internet Applications
• FTP
• telnet
• HTTP/HTML
– Internet protocols/arch
• TCP/IP
• HTML language
2
Multiple processes
• Very common:
–
–
–
–
Clock prog ticks
Doc prints
Browser loads
Playing game
• NT has >100 processes, before you run anything
• Some machines have mult processors
– “dual-core”
• But usually >> processes running
– Can’t simply assign 1 to each processor
•  time-sharing
3
Time-sharing
• Keep track of running processes in
process table
– Vars for each process
– Where it’s at
• Divide time into time-slices
– E.g., 50 ms
• At end of timeslice, have interrupt
– Store info for curr proc in P.T.
– Restart another process from where left off
4
Time-sharing
• Has some overhead
– Memory of P.T.
– Time to switch
• But overall saves time
– Better uses time when waiting for user
• Modern OSs have “preemtive multitasking”
• In Win 95/3.1, OS less strict about
interrupting
5
•  often hung
Mult. procs  compet for resources
• What if 2 progs want to print/draw/read at same
time?
• Only 1 can have access at once, or else conflict
•  OS must control access how?
•
•
•
•
Simple idea: use a flag
1/0, set/clear, says whether printer in use
On req, if clear, allow and set; o.w., make wait
When done, set clear, or give to waiting prog
6
Flags
• Countereg:
• Prog1 requests prn
– Check: clear, so…INTERUPT…set and given
• Prog2 requests prn
– Check: clear so…INTERUPT…set and given X
• Soln: make check-and-set a single op
– “semaphore”
7
Spooling
• Related is spooling
• Won’t discuss strategies, but idea is:
• When app wants to send job to device,
take it, keep in buffer until device is ready
• Common e.g.: print spooler
8
Deadlock
• Very serious problem
• Two processes both waiting for resources,
– Both dependent on other
– Both “block” each other
• P1: wants to upload from HD to netw card
– Has HD access, waiting for netw access
• P2: wants to download from new to HD
– Has netw access, waiting for HD access
•  deadlock!
9
Dining philosophers (Dijkstra)
• 5 philosophers eating sushi, around table
• 5 chopsticks between them
• To eat, phil must pick up two adjacent
chopsticks, one at time
– Sets them down after each bite
• Goal: give strategy avoiding
– Deadlock and
– Starvation (of any phil)
10
Next: Networks
• Collection of connected entities
– “nodes”
• Friends, colleagues – Friendster
– Business people do “networking”
• Phones
• Cities (roads)
11
LANs
• LAN: local area network
– Computers in building, campus
– Connected to share common resources,
comm
• Novell, Microsoft
12
Internet
• Can connect LANs together
• Internet = network of networks
– DARPA, 1973
– Defense Advanced Research Projs Agency
– Originally “ARPAnet”
– Non-graphical
13
Connecting to Internet
• Large org: buy a direct connection
• Small org: link with ISP
• Individual: link to ISP (while connected)
14
Internet Arch
• Each gp/company/school has domain
– microsoft.com
– cuny.edu
• Names registered with ICANN
– Internet Corp for Assigned Names & Netws
• Domain connected to Internet cloud w/ gateway
15
Internet addressing
• Each machine  IP address
– Internet Protocol
– Ids domain and host (machine)
• Written in dotted decimal:
– 192.207.177.133
– First 3: domain
– Last: host
16
CCNY IP
[mjohnson@csfhome1 ~]$ whois 134.74.112.202
[Querying whois.arin.net]
[whois.arin.net]
OrgName: City College of New York
OrgID:
CCNY
Address: 138th Street at Convent Avenue
City:
New York
StateProv: NY
PostalCode: 10031
Country: US
NetRange: 134.74.0.0 - 134.74.255.255
CIDR:
134.74.0.0/16
NetName: CITYCOLLEGE
NetHandle: NET-134-74-0-0-1
Parent: NET-134-0-0-0-0
NetType: Direct Assignment
NameServer: GPX.CCNY.CUNY.EDU
NameServer: NS2.PSI.NET
NameServer: MED1S0.ENGR.CCNY.CUNY.EDU
NameServer: MES1S0.ENGR.CCNY.CUNY.EDU
Comment:
RegDate: 1989-05-10
Updated: 2000-02-23
17
IPs & domain names
• Usually don’t type IPs
• Type domain names
– cuny.edu
• End in .edu, .com, .ca, etc.
• Can define subdomains:
– ccny.cuny.edu
• For each link:
– First look up IP for domain name
– Name server
18
Network topologies
• Token-ring: IBM, 1970s
• Msgs sent in one direction
• Msg propagates until
returns to sender
– Then removed
• Machine only can send if
has the token
• After one successful msg,
sends token to next
19
Network topologies
•
•
•
•
Ethernet – bus-based
To send msg, machine broadcasts to all
2 machines cannot send a msg at once
If 2 try at once, both stop,
– Wait random amount of time
• Like conversation
20
Future
• future: lab session/hw2
– Goal: create and post a webpage
– Also written portion (done independently)
21