Page 85 - Computer_Science_F5
P. 85

Computer Science  Privileged and non-privileged  operating  system  or  specific  programs
                                                     with authorisation. Examples of such
           instruction
                                                     instructions in x86 architecture are;
           Imagine a well-organised restaurant
                                                      (a) MOV to/from Control Registers (such
           kitchen called CPU, where tasks are
                                                         as CR0  and CR3): These instructions
           divided for efficiency and security. The
          FOR ONLINE READING ONLY
           head chef represents the operating system,
                                                         like memory protection and paging.
           having complete control over ingredients      configure essential CPU behavior,
           (resources) and appliances (hardware).        Tampering with them could lead to
           Other cooks represent user programs and       system instability. Example: MOV
           are responsible for specific dishes (tasks),   CR0, eax - This instruction moves
           but they need permission to access certain    the contents of the EAX register
           ingredients and appliances. This analogy      to the Control Register 0 (CR0),
           explains privileged and non-privileged        potentially enabling features like
           instructions in ISA.                          paging or write-protection.
                                                      (b) I/O instructions (IN, OUT): Direct
           Again, consider a real-world example: a       interaction with hardware devices
           word processing program (user program)        like disks or network cards requires
           wants to save a document to the hard drive    privileged access to prevent conflicts
           (a privileged operation). However, it can’t   and data corruption.
           directly access the disk. Instead, it uses   (c) HLT (Halt): This instruction puts
           a system call (like asking the head chef      the processor into a low-power state,
           for permission) to request the operating      effectively stopping all program
           system to perform the save operation on       execution. Only the OS should have
           its behalf. The operating system then uses    the authority to do this.
           privileged instructions to interact with
           the disk controller and write the data.
           Privileged instructions are like secret   Non-privileged instructions
           recipes or master control panels in the  These instructions are like the everyday
           kitchen. They ensure smooth operation  cooking tasks assigned to regular cooks.
           and protect valuable resources. By limiting  They can be used freely by user programs
           access to these important functions, the  (Ring 3) without special permission.
           operating system maintains a stable and  The operating system monitors non-
           secure environment for user programs to  privileged  instructions  to  prevent
           carry out their tasks                     unauthorised access to critical resources
                                                     through privilege checks. An attempt to
           Privileged instructions                   execute a privileged instruction without
           Like  the head chef’s control panel  for  permission results in a protection fault
           adjusting ovens, privileged instructions  exception (like setting off an alarm in the
           require  a  higher  level  of  access  (Ring  kitchen). Examples of such instructions
           0) and can only be executed by the  in x86 architecture are;

                                                  76
                                                                for Advanced Secondary Schools



     Computer Science Form 5.indd   76                                                      23/07/2024   12:32
   80   81   82   83   84   85   86   87   88   89   90