Monday, 21 June 2021

CLASS 11 CS CHAPTER 15

 

CLASS -11  COMPUTER  SCIENCE

     CHAPTER- 15  INSIGHT  INTO  PROGRAM  EXECUTION


🔔To download textbook pdf click on the ''DOWNLOAD'' button below -



NOTES FOR COMPLETE UNDERSTANDING -


  • As we know that computer works on machine level language which is not understandable to a programmer, similarly programmer works with a language which is not understandable by a computer system. 
  • Programmer uses a specific language to write a program like –  C,  C++,  Java etc. 
  • These languages are indirectly understood by computer .
  • Thus, it is essential to convert the instructions written in programmer’s language into a machine compatible language.

  • Basic Flow of Compilation  :
  • Program written in a language is known as source code.
  • Source code is to be written as per the rules of a programming language. 
  • This source code is then converted to machine level language , known as binary code , in order to understand by a computer. 
  • So, a programmer prepares a source code that then  later is converted in to binary code so as to be executed by computer.



  • Translator :
  • A special software is needed to convert a Source Code into binary code which are as under-                    • Compiler                           • Interpreter 
  • Both these software changes source code into binary code but each has way of working different from other. 
  • Compiler works in exactly antonymous (opposite) way of that of interpreter .

  • Compilation :
  • Compiler takes source code and in few stages generates low level-code. 
  • Compilation process stages are      1. Processing                                                                                                                     2. Compilation                                                                                                                         I. Analysis [ front end phase ]                                                                                        II. Synthesis [ back end phase ]                                                                                 3. Assembly                                                                                                                       4. Linking                                                                                                                         5. Loader

  • Processing  : 
  • At this stage extra unnecessary code is removed other than source code like comments and the code which is necessary for the execution of a program is added.

  • Compilation :
  • Compilation phase has two sub stages  -
  • 1.  Analysis     [ front end phase ]                  
  •         Analysis Phase : Analysis phase prepares a table of symbols by all the tokens of source code.
  • 2.  Synthesis    [ back end phase ]   
  •         Synthesis Phase: This phase develops a syntax tree after traversing the source code. A syntax tree is a syntactic tree of source code.


  • Assembly Phase  :
  • This phase creates object code by the help of instructions received from assembly level, an object code is a variant of machine code. 

  • Linking :
  • The code reached in the system at this phase is actually binary code although computer is unable to execute the code as the important libraries required for execution are still not linked with the code. 
  • This work is carried out by linker. So in this phase, OS resolve all memory references & develops an executable (.exe file) file.

  • Loader  : 
  • Loader a part of compiler does loading of an executable file in memory.
  • So now the computer can run this .exe file without help of any additional software.

  • The Interpretation Process :
  • Working of an interpreter is like Compiler. It also changes source code to machine compatible code but it's different from compiler in a definite manner of working. 
  • It converts a program line by line by adding essential libraries. 
  • I.e. before the conversion & execution of second line, first line gets executed completely
  • Interpreter follows same manner of conversion & execution for the rest of the program.



  • Role of Operating System in program running 
  • As we know that execution  of an .exe file is free from any requirement for a computer system. 
  • This executable file executes with the help of operating system.
  • Now a days, importance and complexity of operating system has been increased much because of multiuser and multi-processing concepts. 
  • Operating system does a work of an  interface between a user & hardware. 
  • Also, operating system provides platform to a program to run.

  • OS as a Resource Manager  :
  • Static state of any program code is known as a program and in running state is known as process.
  • When many program executes at the same time, OS improves or enhance the capacity or capability of system by managing resources. Which is to be measured in the terms of throughput. 
  • Throughput= Number of jobs done Time taken 
  • For Multiple Processing, OS provides following function:-                                                       • Process Management                                                                                                     • Process Scheduling                                                                                                         • Memory Management                                                                                                   • I/O Management

  • Process Management  :
  • For execution a program arrives to operating system.
  • Then, a process scheduler of OS loads program into the memory. Now, the program becomes process. Which executes as per instructions.


  • When a program is all set for execution then it is transferred into memory & there it  becomes process. Now, this process follows following states.- 
  • Start State: A state that comes when a program for the first time gets transferred to memory. 
  • Ready State: A state comes when process gets ready for execution & waits as per its turn for CPU  . 
  • Running State: This state comes when CPU works on the process for execution. 
  • Waiting State:  A state that comes when process waits for some resources required for execution for ex- input from user. 
  • Terminated OR Exit: When CPU follows all instructions of a process, its execution gets completed and now it is terminated by OS. This terminated process now gets popped out from memory.


  • OS process manager prepares a data structure for managing of processes which is known as Process Control Block (PCB). 
  • OS develops PCB for every process.
  • When a process gets loaded into memory, it gets an ID that is referred as Process ID or PID and then its PCB is created.
  • PCB keeps important information about process to keep track of process .PCB keeps following information



  • Process Scheduling by OS :
  • As we all know that sometime number of  programs loads together in the computer memory for execution. It is very difficult to manage these processes. Following points are important to know for this --
  • Which process will get CPU time? 
  • Which process will be deleted from CPU?
  • Which process is to be shifted for I/O?
  • How to handle an interruption? 
  • Here interruption is a signal to CPU from a high priority process to have CPU time for it. 
  • This completes task is of OS process scheduler.
  • Process scheduling is an activity of process manager in which  the process manager removes running processes out of CPU & selects the next process.

  • There are some strategies for selection- 
  • First come first serve (FCFS)
  • Round robin scheduling (Round Robin Scheduling)
  • Smallest job first (Shortest Job Next ) etc . 
  • There are other strategies too. Process scheduler also makes some Process Scheduling Queues regarding the order of execution of process.                                                        – Job Queue : All lines of process in a system.                                                              – Ready queue: Line of process with read state.                                                          – Device Queues : like I/O line

  • Memory Management :
  • Since anything to be processed , needs to get load in memory so Memory Management part of OS is also very important. 
  • Memory manager perform following tasks-                                                                 • Stores address of every memory location.                                                                 • It keeps information of allocated memory to a process & required memory also.                                                                                                                                     •  It decides that when the memory is to be released to a process.                             • Responsibility for the protection of data in allocated memory. 
  • Some memory management techniques are-                                                                 – Single Memory Allocation                                                                                           – Partitioned memory allocation                                                                                   – Paged Memory Management                                                                                     – Segmented Memory Management

  • I/O Management :
  • When a process requires any input/output, OS takes this responsibility. 
  • I/O Manager then sends request to CPU that creates an interrupt for CPU. 
  • CPU sends running process for I/O process meanwhile it completes another process . As soon as I/O of first process gets completed, CPU again takes it for completion of other.

  • PARALLEL COMPUTING :
  • At the time of invention of computers, there was single processor in a system that could do only one job at a time. 
  • It performed one task after previous task. With the improvement in technique and development, processors became more able and multi-processor computers were also developed.
  • Multi-processor system can do more than one task at a time, that is known as PARALLEL COMPUTING . 
  • In a parallel computing system -                    
  • A problem is distributed into several individual units. 
  • Every unit executes its own instructions.
  • Instructions from each unit is completed by separate processor. 
  • For this, either multi-processor system is used or multiple systems are to be used by connecting them in network.
  • This saves time, makes a complex problem easy, makes full use of hardware & use peripherals optimally.

  • CLOUD COMPUTING :
  • Cloud Computing is an internet based process that uses computer application.
  • Google apps is an example of cloud computing which provides business applications online. 
  • It is of two types-          • Public Cloud like Google Drive, iCloud etc.                                                                • Private Cloud like BMC software

            🔔MORE MATERIALS TO BE UPLOADED STAY TUNED🔔

WHY Software Developer ?