Insight into Program execution

Similar documents
Chapter 12 : Computer Science. Class XI ( As per CBSE Board) Program Execution. New Syllabus Visit : python.mykvs.in for regular updates

CS370 Operating Systems

CS 322 Operating Systems Practice Midterm Questions

Introducing Python Modules

Software Concepts. It is a translator that converts high level language to machine level language.

Preview. Process Scheduler. Process Scheduling Algorithms for Batch System. Process Scheduling Algorithms for Interactive System

DATA REPRESENTATION. By- Neha Tyagi PGT CS KV 5 Jaipur II Shift, Jaipur Region. Based on CBSE curriculum Class 11. Neha Tyagi, KV 5 Jaipur II Shift

Operating Systems. Computer Science & Information Technology (CS) Rank under AIR 100

Process Scheduling Part 2

UNIT:2. Process Management

PYTHON- AN INNOVATION

Memory management. Requirements. Relocation: program loading. Terms. Relocation. Protection. Sharing. Logical organization. Physical organization

Data Handing in Python

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

Operating Systems Design Fall 2010 Exam 1 Review. Paul Krzyzanowski

OPERATING SYSTEMS CS3502 Spring Processor Scheduling. Chapter 5

Chapter 5: CPU Scheduling

Review. Preview. Three Level Scheduler. Scheduler. Process behavior. Effective CPU Scheduler is essential. Process Scheduling

Computer System Overview

... Lecture 10. Concepts of Mobile Operating Systems. Mobile Business I (WS 2017/18) Prof. Dr. Kai Rannenberg

Lecture Topics. Announcements. Today: Uniprocessor Scheduling (Stallings, chapter ) Next: Advanced Scheduling (Stallings, chapter

Announcements. Reading. Project #1 due in 1 week at 5:00 pm Scheduling Chapter 6 (6 th ed) or Chapter 5 (8 th ed) CMSC 412 S14 (lect 5)

CIS Operating Systems Contiguous Memory Allocation. Professor Qiang Zeng Spring 2018

AC59/AT59/AC110/AT110 OPERATING SYSTEMS & SYSTEMS SOFTWARE DEC 2015

ALL the assignments (A1, A2, A3) and Projects (P0, P1, P2) we have done so far.

Precept 2: Non-preemptive Scheduler. COS 318: Fall 2018

Processes and Threads

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

So far. Next: scheduling next process from Wait to Run. 1/31/08 CSE 30341: Operating Systems Principles

Main Memory (Part I)

Understanding Sorting

CS370 Operating Systems Midterm Review

1.1 CPU I/O Burst Cycle

CPU Scheduling: Objectives

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Processes and threads

5-In switch case statement, every case should have a statement as the last statement A- Jump B- Break C- Exit D- Both a and b

CS370 Operating Systems

CS418 Operating Systems

Processes. OS Structure. OS Structure. Modes of Execution. Typical Functions of an OS Kernel. Non-Kernel OS. COMP755 Advanced Operating Systems

Page Replacement. 3/9/07 CSE 30341: Operating Systems Principles

Chapter 8: Memory Management. Operating System Concepts with Java 8 th Edition

CHAPTER 2: PROCESS MANAGEMENT

The Memory Management Unit. Operating Systems. Autumn CS4023

Subject Teacher: Prof. Sheela Bankar

Agenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2

Multiprogramming. Evolution of OS. Today. Comp 104: Operating Systems Concepts 28/01/2013. Processes Management Scheduling & Resource Allocation

MARK SCHEME for the October/November 2012 series 9691 COMPUTING. 9691/33 Paper 3 (Written Paper), maximum raw mark 90

Announcements/Reminders

CIS Operating Systems Memory Management. Professor Qiang Zeng Fall 2017

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University

Simple Quesries in SQL & Table Creation and Data Manipulation

SMD149 - Operating Systems

Chapter 6: CPU Scheduling

Chapter 8: Memory- Management Strategies. Operating System Concepts 9 th Edition

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

Memory Management. Reading: Silberschatz chapter 9 Reading: Stallings. chapter 7 EEL 358

MARUTHI SCHOOL OF BANKING (MSB)

Machine Code and Assemblers November 6

3. Memory Management

Compiler, Assembler, and Linker

Preview. The Thread Model Motivation of Threads Benefits of Threads Implementation of Thread

Today s Topics. u Thread implementation. l Non-preemptive versus preemptive threads. l Kernel vs. user threads

Lecture 17: Threads and Scheduling. Thursday, 05 Nov 2009

Class average is Undergraduates are performing better. Working with low-level microcontroller timers

OS 1 st Exam Name Solution St # (Q1) (19 points) True/False. Circle the appropriate choice (there are no trick questions).

3. CPU Scheduling. Operating System Concepts with Java 8th Edition Silberschatz, Galvin and Gagn

CS370 Operating Systems

Chapter 3: Processes. Operating System Concepts 8 th Edition,

Sample Questions. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic)

Frequently asked questions from the previous class survey

Memory Management. Memory Management

3.1 (a) The Main Features of Operating Systems

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 21

Optimal Algorithm. Replace page that will not be used for longest period of time Used for measuring how well your algorithm performs

CSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008.

CS/ECE 6780/5780. Al Davis

Page 1. Lab 5 Logistics. Implicit Threads. Explicit Thread Semantics. Problem not enough interrupt pins CS/ECE 6780/5780. Al Davis

CS 3204 Operating Systems Programming Project #2 Job / CPU Scheduling Dr. Sallie Henry Spring 2001 Due on February 27, 2001.

Chapter 8: Main Memory

Language Translation. Compilation vs. interpretation. Compilation diagram. Step 1: compile. Step 2: run. compiler. Compiled program. program.

Processes. Process Management Chapter 3. When does a process gets created? When does a process gets terminated?

Addresses in the source program are generally symbolic. A compiler will typically bind these symbolic addresses to re-locatable addresses.

Introducing Python Pandas

CS 3733 Operating Systems

Administrivia. Deadlock Prevention Techniques. Handling Deadlock. Deadlock Avoidance

Operating Systems Process description and control

Chapter 9: Virtual Memory

OPERATING SYSTEMS. Systems with Multi-programming. CS 3502 Spring Chapter 4

Properties of Processes

Chapter 8: Memory-Management Strategies

Memory Management. 3. What two registers can be used to provide a simple form of memory protection? Base register Limit Register

Memory Management. CSCI 315 Operating Systems Design Department of Computer Science

Techno India Batanagar Department of Computer Science & Engineering. Model Questions. Multiple Choice Questions:

CS 326: Operating Systems. CPU Scheduling. Lecture 6

Lecture 2 Process Management

CSE 153 Design of Operating Systems

Operating Systems Unit 6. Memory Management

General Objectives: To understand the process management in operating system. Specific Objectives: At the end of the unit you should be able to:

CPU Scheduling Algorithms

Programming 1. Lecture 1 COP 3014 Fall August 28, 2017

Transcription:

Insight into Program execution Based on CBSE curriculum Class 11 By- Neha Tyagi PGT CS KV 5 Jaipur II Shift, Jaipur Region

Introduction As we know that computer works on machine level language which is not understandable to a programmer, similarly programmer works with a languagae 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 not directly understandable by computer system. Therefore, it is required to convert the instructions written in programmer s language into machine level language. In this chapter, we will have a look of internal processing of a program code, how a program reaches to execution state and what are the contributions of an operating system in all these processes.

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 souce code is then converted to machine level language, known as binary code, in order to understand by a computer. We can say that a programmer develops a source code which is later converted in to binary code so that it can 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 converts source code into binary code but their way of working is different. Compiler works in exactly opposite manner from interpreter.

Compilation Compiler takes source code and in few stages generates lowlevel-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 1. Processing This stage removes code other than source code like comments and adds the code which is necessary for the execution of a program.

2. Compilation Compilation phase has two sub stages- (i) 1. Analysis [ front end phase ] I. Synthesis [ back end phase ] Analysis Phase : Analysis phase develops a symbol table by all the tokens of source code. (ii) Synthesis Phase: This phase creates a syntax tree after parsing the source code. A syntax tree is a syntactic tree of source code. For ex- syntax tree of 4 * 5 + 9 will be like as -

3. Assembly Phase This phase develops object code with the help of instructions received from assembly level, an object code is a kind of machine code. 4. Linking This code generated from this phase is actually binary code but still computer is not able to execute the code because the important libraries required for execution are still not linked with the code. This work is carried out by linker. In this phase, operating system resolve all memory references and develops executable (.exe file) file.

5. Loader Loader is a part of compiler which loads an executable file in memory. Now computer can run this executable file without the help of any additional software.

The Interpretation Process Working of an interpreter is like Compiler. It also converts source code to machine understandable code but it is different from compiler in some definite manner. It converts a program line by line by adding required libraries. Meaning, before the conversion of second line, first line gets completely executed. Interpreter follows same manner of conversion and execution for the whole program.

Compiler Vs Interpreter

Compiler Vs Interpreter Aspects Compiler Interpreter Input Output Memory Errors It takes the whole program for input. It develops a middle object code of the program. This process requires much memory. It shows all errors together with line number. It takes one line as input. It does not create middle object code. This process does not require much memory. It continues by showing error from one line at a time. Always Required After sucessful compilation of a program, compiler is not further needed. Workload It decreases workload because compiler is not needed again and again for a program. For every run of the prgram interpreter is needed even after successful interpretation. It s continues requirement increases workload.

Role of Operating System in program running As we know that exceution of an.exe file is free from any requirement for a computer system. This excecutable 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 works an as interface between a user and hardware. Also, operating system provides plateform to a program to run.

OS as a Resource Manager A program, in its static state is known as a program and in running state it is known as process. When many program executes at the same time, OS improves or enhabnce the capacity or cabability 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 A program for execution reaches to operating system. Then, process scheduler of OS loads this program into memory. Now, the program becomes process. Which executes as per instructions. For a program, memory is distributed into following blocks- This block contains all local variables, parameters, return addresses of function calls along with CPU state. This block is also known as Stack. This block provides memory for dynamic memory allocation This block contains all Global variables. Thses variables remains in the memory till the end of program. This block contains compiled code of program.

Process Management When a program gets ready for execution then it is transferred into memory and becomes process. Now, this process follows following states.- Start State: This state comes when a program first time transferred to memory. Ready State: This state comes when process gets ready for execution and waits for CPU as per its turn. Running State: This state comes when CPU takes the process for execution. Waiting State: This state comes when process waits for some resource for execution for ex- input from user. Terminated OR Exit: Whn CPU follws all instructions of a process, its exceution gets completed and now it is terminated by OS. This terminated process now gets removed from memory.

Process Management OS process manager develops a data structure to manage a process which is known as Process Control Block (PCB). OS develops PCB for every process. When a process loads into memory, it gets an ID which is known as Process ID or PID and then its PCB is created. PCB keeps imprtant information about process to keep track of process.pcb keeps following information- Process ID State Pointer Priority Program Counter CPU Registers Etc... Stores Process ID. State -> ready, running, waiting.etc Stores address of sub-processes Data of higher or less priority processes It stores the address of next instruction It stores information for execution Etc...

Process Scheduling by OS As we know that many 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 signal for CPU from a high priority process to get CPU time. This completes task is of OS process scheduler. Process scheduling is an activity of process manager in which process manager removes the running processes from CPU and selects the next process.

Process Scheduling by OS.... 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 prepares some Process Scheduling Queues. 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 Because anything to be processed, needs to load in the memory therefore Memory Management part of OS is also very important. Memory manager perform following tasks- Stores address of every memory location. It keeps track of allocated memory to a process and required memory also. It decides that when the memory is to be released to a process. Responsibility for the safety 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 requiring an input or output, OS takes its responsibility. I/O Manager sends a request to CPU which creates an interrupt for CPU. CPU sends running process for I/O meanwhile CPU completes another process. As soon as I/O of first process gets over, CPU again takes it for completion.

PARALLEL COMPUTING At the time of invention of computers, there was only one processor in a system which could perform 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-prossesor computers were also developed. Multi-processor system can perform more than one task at a time, which 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 of each unit is completed by separate processor. For this, either multi-processor system is to be used or multiple systems are to be used in network. This saves time, makes a complex problem easy, makes full use of hardware and use peripherals optimally.

CLOUD COMPUTING Cloud Computing is actually an internet based process which uses computer application. Google apps is an example of cloud computing which provides business applictions online. It is of two types- Public Cloud like Google Drive, icloud etc. Private Cloud like KVS Shaala Darpan.

Thank you Please follow us on our blog- www.pythontrends.wordpress.com