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.

The role of the cpu in the operation


Published on

Published in: Technology
  • Be the first to comment

The role of the cpu in the operation

  1. 1. The role of the CPU in the operation of software Mary Ramsay
  2. 2. Fetch and Execute Cycleinstruction and decoding of software solutions
  3. 3. Fetch-Execute Cycle:- describes the manner in whichthe processor works. That is, it fetches the instructionfrom primary storage, decodes the instruction, executesthe instruction and stores the result.
  4. 4. The CPU is made up of different parts including:ALU – performs the arithmetic and logical operationscarried out by the processor.Registers – (memories) which provides areas to storeresults, locations of instructions. An Accumulator is oneregister which stores the data currently being processed.(like the display of a calculator)Control unit – This coordinates all the actions of theprocessor.
  5. 5. Specific CPU components – Programcounter Is a type of register that stores the location of the next instruction to be processed. The program counter is just like a counter used in an array. (used to located an array element) The program counter is used to locate the next the instruction and then the counter is increased (incremented) to point to the next instruction. See page 149 of text book.
  6. 6. LinkingWhen  a  program  requires  a  par0cular  sub  program,  its  address  is  incorporated  into  the  program  by  a  translaon  system  called  a  linker.    Many  programs  are  complied  at  a  modular  level  (mainline)  and  sub  modules.  A  linker  is  used  to  join  these  compiled  modules  together.  A  linker  is  like  calling  a  module  that  needs  to  be  processed  by  the  CPU.  For  example     1.  A  program  is  complied  and  translated  into  machine  code  (exe)   2.  The  machine  code  is  loaded  into  main  memory  to  be  executed.   3.  The  mainline  is  executed  first  –  with  the  use  of  a  linker  only  the  modules  required  are  loaded   into  RAM.  (This  reduces  the  amount  of  instruc0ons  loaded  into  RAM  at  one  0me)     4.  The  linker  also  used  for  library  rou0nes.  If  the  program  calls  a  library  rou0ne  it  is  only  called   and  loaded  into  main  memory  when  required.  Again  this  saves  memory  resources.  
  7. 7. DLL’s (Dynamic Linking Libraries Is  a  collec0on  of  programs  in  machine  code  which  can  be  accessed  by  other   programs  to  perform  a  specific  task.       E.g  prin0ng  –  when  a  user  chooses  to  print  the  CPU  will  look  in  the  DLL  file  to  get   the  saved  machine  code  (instruc0ons)  to  print  rather  than  searching  the   translated  code.     The  DLL  file  is  loaded  into  RAM  instead.  As  a  result  processing  and  RAM   resources  are  minimsed.  
  8. 8. Translation methods in software solutions
  9. 9. Advantages of a compiler}  Compiled  programs  will  run  faster  than  those  that  have  been  interpreted   as  they  are  already  in  a  form  that  the  processor  understands.  }  Compiled  programs  hide  the  code  from  view  so  that  it  is  more  difficult  to   determine  the  algorithms  used.  }  A  compiled  program  is  oTen  a  lot  smaller  that  the  high-­‐level  code  that   generated  it.  }  A  compiled  program  cannot  be  easily  modified  by  an  inexperienced  user.  
  10. 10. Disadvantages of a compiler}  Run-­‐0me  errors  are  not  apparent  un0l  the  program  has  been  completely   compiled.  }  When  a  compiled  program  is  modified,  the  whole  of  the  program  has  to  be   re-­‐compiled,  regardless  of  the  nature  of  the  modifica0on.  Even  if  a  minor   modifica0on  is  made,  the  whole  program  has  to  be  re-­‐compiled.  This  can   make  the  tes0ng  process  tedious.  
  11. 11. Advantages of an interpreter}  • During testing, both run-time and translation errors become apparent as the code is}  being executed. These errors may then be corrected as they are found. This allows the}  programmer to more quickly debug a program, as the code does not need to be}  completely translated after the changes have been made.}  • The process of interpretation also allows the programmer to quickly add and remove}  debugging aids such as flags and debugging output statements.
  12. 12. }  Disadvantages of an interpreter}  • Programs that are interpreted will run far more slowly than those that have been}  compiled, as each line of code has to be translated before it is executed.}  • The code of an interpreted program is easily accessible to any user or other programmer.}  This means that the illegal use of modules is easier.}  • Programs that are interpreted will generally take up more storage than a similar program}  that has been compiled.
  13. 13. Advantage  of  an  incremental  compiler}  Programs  will  run  faster  than  those  of  an  interpreter;   however,  the  incremental  compiler  retains  the  advantage   for  a  programmer  that  both  run-­‐0me  and  syntax  errors   can  be  iden0fied  as  they  are  reached.    Disadvantages  of  an  incremental  compiler  }  Programs  are  not  executed  as  quickly  as  for  a  compiled   program.  }  Code  is  s0ll  accessible  to  users  and  others.