Presentation is loading. Please wait.

Presentation is loading. Please wait.

Book Reminder… Required reading… “Computer Science: A Modern Introduction (2nd Edition)” Les Goldschlager and Andrew Lister, £22.95 “Fundamentals of Operating.

Similar presentations


Presentation on theme: "Book Reminder… Required reading… “Computer Science: A Modern Introduction (2nd Edition)” Les Goldschlager and Andrew Lister, £22.95 “Fundamentals of Operating."— Presentation transcript:

1 Book Reminder… Required reading… “Computer Science: A Modern Introduction (2nd Edition)” Les Goldschlager and Andrew Lister, £22.95 “Fundamentals of Operating Systems”, A. M. Lister and R. D. Eager, Fifth Edition, Macmillan Computer Science Series, ISBN. 0-333-59848-2, £13.99. “Operating Systems Design and Implementation”, A. S. Tanenbaum, Prentice-Hall International, ISBN. 0-13-630195-9, about £29.99.

2 Obtaining Slides…. Intranet http://info.comp.lancs.ac.uk/ From my homepage… www.comp.lancs.ac.uk/computing/staff/kc/keiths_teach ing.html From library short loan… CD-ROM Queries E-mail:kc@comp.lancs.ac.ukkc@comp.lancs.ac.uk Office:C36

3 Course Structure Topic 1 : Introduction - 1 lecture Topic 2 : Building a computer - 2 lectures Topic 3 : Controlling the computer - 3 lectures Topic 4 : I/O Devices & Networks - 3 lectures Topic 5 : Performance - 1 lecture

4 Course Structure Topic 6 : Introduction to OS - 2 lectures Topic 7 : Concurrency control - 2 lectures Topic 8 : Memory management - 1 lecture Topic 9 : File Systems - 1 lecture Topic 10 : Systems Software - 1 lecture Topic 11 : Java Support - 1 lecture Topic 12 : System security - 1 lecture

5 2: The Fundamentals Storage and manipulation of information within a computer: binary, octal and hex number systems. representing negative numbers in binary. logic gates: AND, OR and NOT. using logic gates to manipulate binary numbers.

6 3: The Programmable Computer How a computer can be constructed from logic gate based components: memory. buses. clocks.

7 3: Microcode Understanding of how a computer may be controlled: microcode. a microcode interpreter: the fetch/execute cycle. relationship between microcode and higher level languages.

8 3: Machine Languages and Assembly Languages Understanding of how a computer may be controlled (contd): rational behind machine and assembly languages. typical format of instructions in machine code and assembly language. addressing modes. simple machine language programs. relationship between machine code and other languages.

9 3: Languages in a Computer System machine code microprogrammed interpreter hardware General Purpose Systems Assembly translators

10 4: Storage Devices and Techniques Knowledge of how a computer can interact with the outside world: examples of input/output devices. operation of a magnetic disk, CD-ROM, mice and printers. techniques for dealing with the processor/device performance mismatch.

11 4 : Networking Support for computer networks. Parallel and serial transmission. Issues for networking at each of seven levels.

12 5 : Processors and Processor Developments Performance Many factors affect the overall performance of a computer: the processor clock speed. the capacity and speed of the memory. the number of bits in each stored word. the features provided by the instruction set. Performance is typically measured in either MIPS or MFLOPS but these are not very useful.

13 5 : Processors and Processor Developments The Role of The Clock The clock period is particularly important in determining the performance of a computer. Clock period = time allocated for each basic internal operation to the processor. E.g. clock frequency of 1 GHz = period of 1 ns. If one instruction per cycle then speed = 1000 MIPS. Speeding up the clock speeds up the processor.

14 5 : Pipelined Systems Pipelining is a method which can be used to increase the speed of operation of the processor. The basic task is divided into a number of subtasks. Each task can be performed by a separate unit.

15 5 : Pipelined Systems... contd. Analogous to conveyor-belts in a factory. IN OUT Stage 1Stage 2Stage 3

16 5 : Problems With Pipelines Pipelines assume:- instructions are executed in sequence. no interaction between tasks. Problems caused by:- branch instructions. data dependencies. conflicts for hardware resources.

17 5 : Processor Design: RISC and CISC The design of a computer’s instruction set can have a significant impact on its performance. Key question is how sophisticated to make the instruction set. Traditional approach is to provide complex instruction sets: replace sequences of primitive operations. many addressing modes. support for procedure calls and parameter passing. support for operating system functions.

18 5 : Multiprocessor Systems Another approach to improving performance is to introduce more processors. Each processor works on some part of the overall task in parallel. Problems: dividing the task into parallel units with the fewest possible dependencies. minimising the communication overheads between the processors.

19 6: Operating Systems Provide a Virtual Machine Hardware Operating System Specific Interface O/S

20 6: Operating Systems Also Manage Resources Share resources between multiple programs and multiple users. Ensure use of resources is optimised.

21 6: Operating Systems in Context Applications Software (e.g. packages) System Software (e.g. operating systems) Computer Hardware (e.g. CPU, memory, I/O devices)

22 6: Loading Programs: a Basic OS Task Sit in a loop waiting for a program to be ready to run. Load the specified program from disk into memory. Use base and limit registers to make sure program addresses work. When the program has finished go back to the loop and wait for another to be ready.

23 7: Why Multiple Programs? Support multiple tasks by users. Allow tasks to proceed in background. Allow programs to be structured as independent tasks.

24 7: Some Simple Definitions Sequential = doing things one at a time. Concurrent = doing things (apparently) at the same time. Parallel = doing things at the same time.

25 7: Summary of Execution Patterns Sequential Concurrent Parallel

26 7: Extending Our Dispatcher to Deal With Concurrency Load programs into different parts of memory. Make each program save its data and where it is when it wants to temporarily stop running (c.f. interrupts). Modify the dispatcher so it can jump to these saved points.

27 7: The Process State Model … Ready Running Process is selected to run Blocked Process blocks (e.g. I/O) Blocking operation finishes (e.g. I/O)

28 7: Round Robin Scheduling

29 7: Process Interaction Processes running on the same machine inevitably effect each other. This may be negative:- longer execution times competition for resources modification of shared data Or positive:- delegation of jobs modification of shared data

30 7: Concurrency Control In order to ensure safe execution of concurrent processes concurrency control is required. In many cases, concurrency control is required to implement mutual exclusion. Mutual exclusion ensures only one process has access to a given resource at a time. Implies only one process has access to critical sections of code.

31 7: Semaphores Semaphores are non negative integers which (apart from their initialisation) can only be operated on by the operations wait and signal. Signal adds one to the value of a semaphore. Wait subtracts one from the value of the semaphore unless the semaphore is zero in which case the process is blocked until the subtraction can be done without making the semaphore negative. Semaphores are implemented as queues.

32 7: The Cashpoint Program using Semaphores Begin wait (mutex); read A; read B; A := A + 50; B := B - 50; write A; write B; signal (mutex); End. Begin wait (mutex); read B; B : = B + 100; write B; signal (mutex); End. Semaphore : mutex := 1;

33 7: Semaphores and Resource Allocation Begin prepare data; wait (disk); wait (printer); print (data); signal (printer); signal (disk); End. Begin prepare data; wait (printer); wait (disk); print (data); signal (disk); signal (printer); End.

34 7: Deadlock ! Got Disk, Waiting on Printer Got Printer, Waiting on Disk

35 7: Conditions for Deadlock The resources involved are unsharable. Processes hold the resources they have been allocated while waiting for new ones. Resources cannot be pre-emptied. A circular chain of processes exists.

36 7: Solutions to Deadlock Problem Prevent deadlock. Detect deadlock and try to recover. Avoid deadlock by anticipating events.

37 8: Processes and Memory If you have only one program and it is smaller than memory then there are no problems - use static addressing. But.. If we want multiple programs need to be able to relocate programs and their data - this is tricky. The dispatcher we built in lecture 2 used base and limit registers to enable code to be re-located.

38 8: Memory management If we try and run multiple processes in memory then as they start and finish so the memory becomes fragmented. The solution is to compact the processes currently running. But... compaction is very slow (lots of copy instructions).

39 8: Reducing the Impact of Fragmentation Selecting the optimum place in memory to start a process can help reduce the effect of fragmentation. Four common solutions:- Best Fit Worst Fit First Fit Buddy

40 8: Swapping Suppose a program hasn’t finished - just been blocked. We can still run other processes if we can shift the original process out of memory while it is blocked. Best (only) place to put it is on disk - this is called swapping. But still limited to the size of main memory.

41 8: Paging - A Real Important Concept The basic idea - divide all memory up into page frames. Divide processes up into pages. Maintain a table which allows you to map addresses to the appropriate page/page frame. Very widely used - 486 processors have paging support built in.

42 1 23 8: Paging.. How It Works Process A Memory

43 8: Placement and Replacement Policies Placement doesn’t matter because you can’t subdivide pages. Replacement is critical because you want to avoid swapping out pages which will be accessed again soon. Three common strategies:- Least Recently Used (LRU). Least Frequently Used (LFU). First In First Our (FIFO).

44 8: Thrashing Processor Utilisation No. of Processes

45 9 : File System Objectives Provide persistent storage for programs and data files. creation and deletion of files reading and writing of files allow reference to files by symbolic name manage space available on secondary storage protect files from unauthorised access and system failure allow sharing of files

46 9 : Basic Operations fd = open (filename, mode) fd = a file descriptor mode = read or write Read (fd, buffer) Write (fd, buffer) Seek (fd, position) Close (fd)

47 9 : Storing Files on Disk The next issue to address is how to store files on the disk. Remember disks are block oriented devices, Therefore files must be stored as a series of blocks. Of course the question is how big to make the blocks ?

48 9 : Block Size and File System Performance The average UNIX file is 1K. If blocks are made large then small files are very wasteful of disk space. For example, if we make the block size equal to one cylinder (32K) then 97% of the disk space is wasted.

49 9: The Trade Off 1282565121K2K4K8K 100 150 50 0 Kbytes/Sec 0 25 50 75 100 200 Data Rate Disk space utilisation Block Size Assuming file size of 1K Disk space utilisation (%)

50 9 : Sharing and Security This is only an issue in multi-user operating systems or those which support remote access to files. The owners of files must be able to specify the access rights for files. Two main approaches are to use either a protection mask or access control lists.

51 10: Interfacing to the O/S To many people the interface to the o/s is via, e.g. windows, icons, menus and pointers. Examples of operating systems with WIMP interfaces are MacOS and Windows95. The windowing system doesn’t have to be bundled with the operating system: X Windows.

52 10 : Interfacing to the O/S... Many O/Ss still have textual command interfaces. All O/Ss have a ‘function call’ based interface: gettimeofday (). open (), close (). The function calls to the O/S are called system calls. Complex O/Ss such as UNIX have hundreds of system calls.

53 10 : Protection System calls require access to the underlying operating system data structures which is not normally allowed. Hence, system calls typically run as operating system processes not user processes (different permissions for, e.g. files). As a result, there is a context switch each time a system call takes place. Context switches are expensive and hence minimising system calls is important.

54 10: Other Systems Software Operating systems. Editors: emacs. vi. Assemblers. Compilers and Interpreters.

55 10: Approaches to Language Translation machine code microprogrammed interpreter hardware General Purpose Systems Assembly translators

56 10: Approaches to Language Translation There are two basic approaches to language translation: interpretation. compilation. Each approach has its own advantages and disadvantages.

57 11: Java on a Host OS Host Operating System Java Run- Time libawt libnet Foundation Classes AWT Classes Net Classes Java API

58 11: JavaOS Java Virtual Machine Foundation Classes AWT Classes Net & I/O Classes JavaOS Windows JavaOS Graphics TCPNFS UDP IP Device Drivers Java API

59 11: Analysis of JavaOS JavaOS differs from a conventional system in several ways: no file system no virtual memory no separate address space support for only one program language no o/s specific system calls

60 11: Analysis of JavaOS JavaOs is like a conventional system: it is bootable it supports user authentication it supports protection between applets it has device drivers it communicates using IP etc. it has its own windowing system it has its own API used to run applications

61 11: Analysis of JavaOS Performance Depends in part on whether Java code is JIT compiled or interpreted Prototypes appear to achieve good performance because of the lack of layers Space Fits easily into 4 MB ROM and 4MB RAM Minimal kernel will run in 512K ROM, 128K RAM

62 12: Security If our OS is capable of process scheduling then we can have concurrent processing. These processes need not be owned by the same user. Users have an identity on the system with an associated user identifier Users login (i.e. are admitted to the system) Each process they run is attributed to their identity

63 12: Let’s stop bad users getting in Need to assert that user is who they claim to be. Identity cards Physical characteristics, e.g. fingerprints, finger length analysis, retina scans! Signature analysis Has to be acceptable. e.g. Urine analysis!

64 12: Passwords Login program prompts the user for their login name and password. The password is encrypted immediately. The encrypted password is checked against a stored form. If it matches they get in!

65 12: How secure are they? In ‘79, Morris and Thompson compiled a list of words. names, cities, a moderate dictionary, backward words, short strings of random characters, etc. The words were encrypted using a public algorithm (UNIX scheme). They broke 86% of their system’s passwords!

66 12: Questions and answers User supplies a long list of Q&As on joining. Login process consists of questioning the user. Must be simple enough not to require writing down. e.g. What is the name of your pet ?

67 12: Challenge-response User chooses an algorithm on joining, e.g. simple polynomial x2. On logging in the user is asked to respond to an appropriate challenge, e.g. 8 And must respond with the correct answer, i.e. 64. Variety can be introduced depending on terminal, time etc.

68 12: Can increase security by... Restricting points of access e.g. UNIX superuser can only log in from the console (notionally!) Dialup lines can use a callback system. The user dials up and logs in The system immediately breaks the connection and calls the user on a prearranged number Record logins and present information to users allowing detection of security breeches.

69 Obtaining Slides…. Intranet http://info.comp.lancs.ac.uk/ From my homepage… www.comp.lancs.ac.uk/computing/staff/kc/keiths_teach ing.html From library short loan… CD-ROM Queries E-mail:kc@comp.lancs.ac.ukkc@comp.lancs.ac.uk Office:C36


Download ppt "Book Reminder… Required reading… “Computer Science: A Modern Introduction (2nd Edition)” Les Goldschlager and Andrew Lister, £22.95 “Fundamentals of Operating."

Similar presentations


Ads by Google