WEB System lecture notes PDF

Title WEB System lecture notes
Author Kevin Chen
Course Web Systems
Institution University of Technology Sydney
Pages 16
File Size 1.2 MB
File Type PDF
Total Downloads 128
Total Views 260

Summary

Week 2: Common operating system Mainframe OS since 1960  Minicomputers  Unix-like OS (e. Linux), less expensive and powerful than mainframe (supercomputer).  Personal computers (Mac OS/X, windows)  Embedded systems  designed to perform specific tasks  internet of things (loT) – devices connec...


Description

Week 2: Common operating system  Mainframe OS since 1960  Minicomputers  Unix-like OS (e.g. Linux), less expensive and powerful than mainframe (supercomputer).  Personal computers (Mac OS/X, windows)  Embedded systems  designed to perform specific tasks  internet of things (loT) – devices connected to internet and constantly collective/sharing data without human interact ONION Model Hardware layer (Core)  CPU, Memory, inputs/outputs (keyboard, printer), storage (flash, drive) Kernel layer (2nd layer)  Controls hardware, Provides resources and services to applications (e.g. memory) Application/Userland layer (3rd layer)  program that does something for the user, Services run behind the scenes (E.g. security). User interface layer (Outer)  shell (command line interface [CLI] – make sets of command) available to user, Graphical user interface (GUI) that present graphics

Interfaces – design interface through: 1. 2. 3. 4. 5.

Pick intended audience Good workflow ‘polish’ (provide beautiful interface) Consistency (consistent Psychology (Human computer interaction)

GUI VS CLI GLI  interact through keyboard and monitor which only print TEXTS GUI  interact via windows, icons, menu, pointer device (WIMP) ADV of GUI Little/no experience needed User friendly Good for graphics

DISADV OF GUI Function is limited (keyboard key be faster) Can crush the system Needs better hardware User unsure what OS is doing

ADV OF CLI Greater flexibility

DISADV OF CLI Hard to learn

Essential for system admin Runs on simple hardware Difficult to crush Can run remotely (rural)

Cannot see the output No graphics Inconsistent commands Expert mode (higher risk)

Batch files  contain list of command to be performed by command line interpreter Characteristics of scripting language (e.g. python, Pearl, Java)  variables untyped (can be used as number or string), Language syntax often inconsistent (E.g. pearl  various ways of doing same thing). Week 3: UNIX  Used continuously since 1969  Oldest operating system was VM/CMS by IBM Unix survived as:  No one owns the ideas  UNIX is ideas and non are secret, anyone can use such idea  Based on simple concepts (files, process, permissions, and users)  allow easier incorporating of new ideas and technologies  Portable  written in programming C  not tied to particular CPU  UNIX is mostly free  1993/1994 free UNIX onwards  available to cheap intel based PCs  Efficient, stable and relatively secure  crush rate is rare, files have owners and security permission is tight (fewer virus).  Set of tools approach  simple commands, pipes and I/O direction Filesystems  Part of OS that manage data storage and access Logical filesystem  user view of file system  Files (programs, data files)  Directories (store files, often in tree format)  Partition (physical structure such as CD, drives that stores files and it can be divided into different disk – disk A, disk B)  disconnecting one disk wont affect others (independent from others)  Directories vs Partition  directories create logical division in filesystem and used for organisational purpose while partition is more physical division in filesystem Physical filesystem  actual data stored in the system Theory of Trees: Tree is a collection of nodes along with a relation (parenthood)     

Edge is a branch of the tree  a -> b = a is the parent of b Every node has a parent Leaf is a node with no children Siblings are nodes with same parent ./ = root, . = current directory (node), .. = parent of current directory

File storage  Modern PC have a hard disk and solid state drivers (SSD) Disk and SSD is managed by  Disk physical structure - Tracks  concentric rings on the platter - Heads  read data from a platter - Cylinders  collection of all tracks on platters - Sectors  part of track of data - Disk is a stack of magnetic platters, divided into cylinders and each cylinder contains circular tracks then separated into sector - Read/write operation provided by heads - SSD has no moving parts but copies the move of a rotating hard disk  Formatting  operation that creates physical disk structure - Organizing and marking the surface of a disk into tracks, sectors and cylinders  Disk logical structure - Partitions: Disks can be subdivided into partition and each is an independent storage device - Blocks: OS view all disk space as array of fixed size logical blocks (a smallest unit of data to transfer)  Fill allocation methods - Directory  table of info OS uses to locate blocks associated with files on a disk

 Contiguous allocation  set of blocks allocated to a file at time of file creation - Supports RANDOM access, fragmentation of unused space will occur, often used in magnetic tapes.

 Chained or linked allocation - File written as non-contiguous blocks - Each block contains (a pointer to) the address of next block (end block will become negative number – end of file marker) - Directory head block number and file length - Good for SEQUENTIAL access not random access

 Indexed allocation - “tree” based allocation system - index data blocks contain list of data blocks

UNIX indexed -

Files stored on blocks called inode Each file/directory is referenced by inode Efficient use of space and easy to read blocks Directories contain name of files and inode number for the file INODE store File MetaData  size, Owner id, group id  DOESN’T contain name of file INODE store Pointers  to the block that stores file data

INODE STORES/CONSISTS:

-

Single indirect block  pointer to disk block  contain index of pointers to data blocks Double indirect block  pointer to more single indirect block Triple indirect block  pointer to more double indirect block

SUM: Contiguous  GOOD FOR DIRECT STORAGE AND TINY FILE SYSTEM Chained/linked  GOOD FOR ARCHIVAL (BACKUP) Indexed  REASONABLE FOR LARGE SYSTEMS Efficiency Complexity theory - How much time (how many reads) takes to find particular block of a file  Contiguous O(1)  about “1”, read any block through STARTING BLOCK + BLOCK no. TO READ - 1  Chained O(n)  n blocks, read Nth block through  Index O(log n):

WEEK 4: WEB AND SECURITY Security principle:  Confidentiality  Information accessible only to authorised user  Integrity  Safeguarding accuracy/completeness of information and processing methods (only entered by authorised user, cant be altered without detection). Detection (use audit trials: a log; hashes, checksums and message digests  Availability  ensure authorised user have access when required (System survive failure -have a hot/cold standby mechanism and backups, System resist attack – firewall, content distributed network (CDN) protects from distributed denial of service).  Authenticity  stolen identity  Security attack  security service (make use 1 or more security mechanisms)  security mechanism (detect, prevent, recover from attack). Types of security attacks: -Credit card detail was snipped

-

Money amount was modified

Typical security service  Confidentiality (privacy – encryption), authentication (who created or sent it), integrity (has not been altered).  Non-repudiation  promise to do something and it happens (e.g. paypal)  Access controls  prevent misuse of resources  Availability  permanence, non-erasure of payment amount Authentication:  Something you know(pass, pin), Something you have (key, SMS), Something you are (fingerprint, face/voice recognition).  Web authenticate through identity verification (user id, password) – password is not encryption  Web form (HTTPs) is safe for password encryption  Client side certificate  third part validated identity and gives electronic key card, password is strongly protected  Unix authentication: user id and pw in large scale stored in central directory service (e.g. active directory – Microsoft, LDAP – everyone else)

Access control:  Physical (swipe card, security guard)  Logical  enforced by OS, application, and security devices such as FIREWALL  UNIX security control: 3 level of security (user – owner of file, group, others - public), 3 permission in file and directory (read, write – update file, execute) Availability  Survive failure  have a hold/cold standby mechanism and have redundancy (have more than 1 server, data centre or network connection).  Hold standby -> online system kept in sync  Cold standby -> update system everyday and its turned off – can be started up quickly  Backups  e.g. incremental backups  Firewall (resist attack)  Redundancy (resist attack)  protect against Distributed Denial of Service (DDos) via network infrastructure  Vaccinate (resist attack)  anti-malware, monitor by security scanning system, train staff WEEK 5 – WEB 1 Web content management  Web server usually displays web pages e.g. index.html  Sometimes Large web sites manage content auto via “Content management System” Web page development  Contains Text and Markup – (HTML, CSS, HTML STRUCTURES text into headings, lists, paragraphs).  Web browser present text in way which is aligned with structure (XHTML – strict version of HTML which prevents misinterpretation of text by the browser). - Every web browser has a HTML viewer called an ‘engine’ WEEK 6 – WEB 2 HTML consists structural (component and area on the page) and presentation (style of info presented e.g. colour, size, background). Cascading style sheet (CSS)  simple mechanism for adding style W3C  responsible for defining many web standards and CSS is one of them Rules defining how element are to be presented:    

Tag (any HTML tag) #Id (a particular element of our page) .class (apply style to given group of elements) Inline (hardcoding style without a stylesheet)  HTML ()

4 ways implementing CSS:  Imported  add content of external CSS file to another set of CSS rule  Linked  external CSS file included in the head of the page *BEST WAY*  Embedded  including CSS as section in the head of the page

 Inline  style included as an attribute of a tag Styles cascade in order of precedence (importance): (lowest to highest) 1. 2. 3. 4. 5. 6. 7.

Browser default setting User settings in browser Linked external CSS Imported CSS Embedded CSS Inline CSS HTML tag attributes

Benefit of CSS:  Simpler and cleaner code, uniformity, ability to define the look of several pages from one location, more power and flexibility than old methods, better code reuse. Disadvantages:  not all browser follow standards properly  quirks mode  where standards based browsers try to simulate broken internet explorer WEEK 7: OPERATING SYSTEM 3 Process management  processes are programs in execution (tasks)  every time program is run, new process is created  1 main process system initially starts is KERNEL  Concurrent processing (run multiple programs)  multiprogramming, multitasking, multithreading, and multiprocessing  Multiprogramming (‘cooperative’)  process keeps running until block and control will be passed to next process (known as interrupt handler), BUT it can get ‘hangs’ when in a loop  Multitasking (‘pre-emptive’)  sets timer on all processes (“fair share” CPU time), can have priorities (high, normal, low)  Multithreading  multiple instance of same code (e.g. same process in memory but 2 or more execute paths)  EFFICIENT use of resources (e.g. MEMORY – only use 1 process)  Multiprocessing  uses 2 or more CPU in multitasking Process state 1. 2. 3. 4. 5. 6. 

Process is created Waiting to be run by OS OS run the process Process runs until it gets blocked (needs some resources) and waits until it gets the resource OS will then restart the process OS stops the process Resources needed when process is blocked: HARDWARE (move mouse, network), PROGRAMS (pause for input, wait for block of data to load from disk, run time error).

Process scheduling (decides when to run each process on which CPU – using QUENE)  It will go in order (process 1 running, process 2 waits until 1 finishes), process that waits are called waiting process

 Algorithms  first in first out, pre-emptive, round robin Inter process communication  Processes communicate with each other (called IPC)  Done via file sharing, shared memory, signals, sockets, messages, pipes, lock

Resource management  Resources are things process might need to run (files, network, keyboards etc.)  Resource contention  when one process using/alter the resource, no other process can use it until it finishes  Solution to deadlock (avoid altering)  semaphore (flag held by process changing the memory), lock files (not readable/writeable without key). What is deadlock?  Process compete for limited number of resources  A process may have to wait for some resource which is held by another process  if the resource never gets released, this is called “deadlock” what cause deadlock?  Mutual exclusion (resource that can only be accessed by one process at a time  Hold and wait (there exist one process holding at least one resource and is waiting for another resource) Dealing with deadlock:  Avoidance/prevention (OS decides which process to use resources and when)  Detection/management (find and break deadlock)

Memory management  OS loads program into MEMORY to execute  OS needs to manage allocation of memory to process Memory management allows us to:      

Run more processes than we can fit into physical memory Optimize use of expensive RAM Keep track where processes are and what block of memory they own Provide access control to memory (security) Decide where process is loaded into memory Allocates/deallocates memory

Physical and local addressing:  Computer have fixed amount of memory (RAM)  OS kernel can directly access physical memory using “physical addressing”  Processes addresses to their own memory (logical memory)  Typical OS allocates PAGES to a process  Logical/virtual addressing  when OS translates logical addresses to physical addresses  Logical address space is larger than physical space (RAM) when we have virtual memory Virtual memory:  Virtual memory make part of the hard disk like main memory to the process  Means program may have more memory than available  Virtual memory MUCH slower than RAM  Virtual memory can pretend as physical memory

 when accessing page 1 process A (which is not in memory), 1 page will be swapped out for page 1 to be in Disadvantage of virtual memory and locality:    

paging is slow (because disk is slow), add RAM can fix it locality is “guesswork” on what needs to be in RAM temporal locality  recently accessed memory to be accessed again E.g. LOOP variables spatial locality  location near recently accessed memory are likely to be accessed soon E.g. ARRAY

WEEK 8: COMPUTER SCIENCE 1 History of computing: 1. Charles babbage (1793- 1871)  designed analytic engine 2. Luigi menabrea (1809 – 1896)  extended on babbage’s design 3. Lady ada lovelace (1815 – 1852) Memory  stores program and data, encoded as binary so processor can access  ROM (read only memory)  permanent information

 RAM (random access memory)  computer forgets when its off and program changes content Central processing unit (CPU) – 3 main parts  Control unit  sets up ALU with instruction and data from memory  Arithmetic logic unit (ALU)  does the calculations (+, -, division)  Registers  small and fast memory in the CPU, loaded by control unit and accessible by ALU Processor function:  “fetch execute cycle” in CPU  gets instruction from memory and executes them  goes on until the machine is physically turned off

Data representation  CPU don’t understand characters or images or documents (only binary) History of character encoding: Pre-historic: EBCDIC  used only IBM mainframes, punch cards Historic: ASCII  7 bits and 128 different characters (adds 0 Infront making it 8 bits – 1 byte per character)  ISO 8859 – extension of ASCII to include latin alphabets

   

Unicode  expands ASCII to 16 bits or more to represent over 12000 characters UTF-8  common, compatible with ASCII UTF-16  every character as 16 bits (2 bytes) or 32 bits (4 bytes) FourCC or Magic Number are bytes within the file that tells the OS to put the actual real file type

Number system (numeral system)  way of presenting information (binary, decimal, octal and hexadecimal) Common numbering system: Hindu-Arabic system Base 10: The decimal system

Base 2: Binary system

Base 16: hexadecimal numbers (short cut of binary)

 1 hexadecimal digit = 4 binary digits

Another shortcut – Base 8 (octal)  Represented with 3 bits...


Similar Free PDFs