Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Chapter 1


Published on

  • Be the first to comment

  • Be the first to like this

Chapter 1

  1. 1. Lecture 1 Introduction Chapter1
  2. 2. What is systems Programming? <ul><li>Simple model: Single User </li></ul>
  3. 3. What is systems Programming? <ul><li>Reality: multiple users, multiple programs and multiple devices </li></ul>
  4. 4. What is systems Programming? <ul><li>Role of operating system: </li></ul><ul><ul><li>Manage and protect all the resources and to connect the various devices to the various program . </li></ul></ul>Kernel User Space System space
  5. 5. What is systems Programming? <ul><li>The operating system is a program. </li></ul><ul><li>The code for operating system reside in the computer’s memory with other programs created by users. </li></ul><ul><li>The operating system connects those programs to the outside world. </li></ul>
  6. 6. What is systems Programming? <ul><li>Providing Services to Program! </li></ul><ul><ul><li>Only kernel can access to all the devices </li></ul></ul><ul><ul><ul><li>Terminal, disks, printers, … </li></ul></ul></ul><ul><ul><li>Kernel provides service for user programs to access devices </li></ul></ul>
  7. 7. Understand systems Programming? <ul><li>The kernel provides access to system resources. </li></ul><ul><li>System programs use those services directly. </li></ul><ul><li>Systems resources: </li></ul><ul><ul><li>Processor </li></ul></ul><ul><ul><li>I/O </li></ul></ul><ul><ul><li>Process Management </li></ul></ul><ul><ul><li>Memory </li></ul></ul><ul><ul><li>Devices </li></ul></ul><ul><ul><li>Timers </li></ul></ul><ul><ul><li>Inter-process Communication </li></ul></ul><ul><ul><li>Networking </li></ul></ul>
  8. 8. Login – How the shell work? <ul><li>If your name and password are correct, the system starts up a program called a shell and connects you to that shell. </li></ul><ul><li>The shell prompts to tell the </li></ul><ul><li>user it is ready to run a </li></ul><ul><li>program. </li></ul><ul><li>Try date , fortune commands </li></ul>
  9. 9. Directory/File <ul><li>ls </li></ul><ul><li>cd </li></ul><ul><li>pwd </li></ul><ul><li>rmdir </li></ul><ul><li>cat </li></ul><ul><li>more </li></ul><ul><li>cp </li></ul><ul><li>mv </li></ul><ul><li>File permission </li></ul>
  10. 10. Bc – UNIX Desk Top Calcualtor <ul><li>>bc </li></ul><ul><li>2+3 </li></ul><ul><li>5 </li></ul><ul><li>Exit from bc, press Ctrl – D </li></ul><ul><li>stop a process, press Ctrl - Z </li></ul>
  11. 11. more command <ul><ul><li>Show 24 lines from the input </li></ul></ul><ul><ul><li>Print [more?] message </li></ul></ul><ul><ul><li>Input Enter, SPACE, or q </li></ul></ul><ul><ul><li>If Enter, advance one line </li></ul></ul><ul><ul><li>If SPACE </li></ul></ul><ul><ul><li>If q  exit </li></ul></ul>
  12. 12. more command <ul><li>Code </li></ul><ul><ul><li>Version 1: more read stdin  more01 does not pause after 24 lines. It reads user command from the same stream as the data. </li></ul></ul>
  13. 13. more command <ul><li>Code </li></ul><ul><ul><li>Version 2: more reads user input from a terminal </li></ul></ul><ul><ul><li>Connect to the keyboard and screen using /dev/tty </li></ul></ul>