Download System Programming and Operating system and more Assignments Microprocessors in PDF only on Docsity!
INDEX
Sr. No. Title of Assignment Page No. Group A 1 Design suitable data structures and implement pass-I of a two-pass assembler for pseudo-machine in Java using object oriented feature. Implementation should consist of a few instructions from each category and few assembler directives.
2 Implement Pass-II of two pass assembler for pseudo-machine in Java using object oriented features. The output of assignment-1 (intermediate file and symbol table) should be input for this assignment.
3 Design suitable data structures and implement pass-I of a two-pass macro processor using OOP features in Java
4 Write a Java program for pass-II of a two-pass macro-processor. The output of assignment-3 (MNT, MDT and file without any macro definitions) should be input for this assignment.
Group B 5 Write a program to create Dynamic Link Library for any mathematical operation and write an application program to test it. (Java Native Interface / Use VB or VC++).
6 Write a program using Lex specifications to implement lexical analysis phase of compiler to generate tokens of subset of ‘Java’ program.
7 Write a program using Lex specifications to implement lexical analysis phase of compiler to count no. of words, lines and characters of given input file.
8 Write a program using YACC specifications to implement syntax analysis phase of compiler to validate type and syntax of variable declaration in Java.
9 Write a program using YACC specifications to implement syntax analysis phase of compiler to recognize simple and compound sentences given in input file.
Group C 10 Write a Java program (using OOP features) to implement following scheduling algorithms: FCFS , SJF (Preemptive), Priority (Non-Preemptive) and Round Robin (Preemptive)
11 Write a Java program to implement Banker’s Algorithm 76 12 Implement UNIX system calls like ps, fork, join, exec family, and wait for process management (use shell script/ Java/ C programming).
13 Study assignment on process scheduling algorithms in Android and Tizen. 92
Group D 14 Write a Java Program (using OOP features) to implement paging simulation using
- Least Recently Used (LRU)
- Optimal algorithm
System Programming & OS Laboratory TE Computer Engineering (2019 Course) Group - A Assignment No. 1 Title: Design suitable data structures and implement pass-I of a two-pass assembler for pseudo-machine in Java using object oriented feature. Implementation should consist of a few instructions from each category and few assembler directives.
2. Objectives: - To understand data structures to be used in pass I of an assembler. - To implement pass I of an assembler 3. Problem Statement: Write a program to create pass-I Assembler 4. Outcomes: After completion of this assignment students will be able to: - Understand the concept of Pass-I Assembler - Understand the Programming language of Java 5. Software Requirements: ∙ Linux OS, JDK1. 6. Hardware Requirement:
- 4GB RAM ,500GB HDD 7. Theory Concepts: A language translator bridges an execution gap to machine language of computer system. An assembler is a language translator whose source language is assembly language. An Assembler is a program that accepts as input an Assembly language program and converts it into machine language. Language processing activity consists of two phases, Analysis phase and synthesis phase. Analysis of source program consists of three components, Lexical rules, syntax rules and semantic rules. Lexical rules govern the formation of valid statements in source language. Semantic rules associate the formation meaning with valid statements of language. Synthesis
System Programming & OS Laboratory TE Computer Engineering (2019 Course) Validate the mnemonic operation code by looking it up in the mnemonics table.Determine the machine storage requirements of the statement by considering the mnemonic operation code and operand fields of the statement. Calculate the address of the address of the first machine word following the target code generated for this statement (Location Counter Processing) Synthesis Phase: Obtain the machine operation code corresponding to the mnemonic operation code by searching the mnemonic table. Obtain the address of the operand from the symbol table. Synthesize the machine instruction or the machine form of the constant as the case may be. DATA STRUCTURES OF A TWO PASS ASSEMBLER: Data Structure of Assembler: a) Operation code table (OPTAB) :This is used for storing mnemonic, operation code and class of instruction Structure of OPTAB is as follows b) Data structure updated during translation: Also called as translation time data structure. They are System Programming & OS Laboratory TE Computer Engineering (2019 Course) I. SYMBOL TABLE (SYMTAB) : Ii contains entries such symbol,it‟s address and value.
SYMBOL TABLE have following fields : Name of symbol Symbol Address Value II. LITERAL TABLE (LITTAB) : it contains entries such as literal and it‟s value. Literal Table has following fields : literal Address of Literal III. POOL TABLE (POOLTAB): Contains literal number of the starting literal of each literal pool. Pool TABLE (pooltab) have following fields. LITERAL_NO IV: Location Counter which contains address of next instruction by calculating length of each instruction. Design of a Two Pass Assembler: - Tasks performed by the passes of two-pass assembler are as follows: Pass I: - Separate the symbol, mnemonic opcode and operand fields. Determine the storage-required foe every assembly language statement and update the location counter. Build the symbol table and the literal table. Construct the intermediate code for every assembly language statement. System Programming & OS Laboratory TE Computer Engineering (2019 Course) Pass II: - Synthesize the target code by processing the intermediate code generated during pass INTERMEDIATE CODE REPRESENTATION
IV. If statement is START or ORIGEN Process location counter accordingly. V. If an EQU statement, assign value to symbol by correcting entry in symbol table. VI. For declarative statement update code, size and location counter. VII. Generate intermediate code. VIII. Pass this intermediate code to pass -2. Conclusion: Thus, I have studied visual programming and implemented dynamic link library application for arithmetic operation References: J. J. Donovan, “Systems Programming”, McGraw Hill.[ chapter 3 topic 3.0,3.1, 3.2.1 in brief ,3.2.2 figure 3.3 &3.5] Oral Questions: [Write short answer]
- Explain what is meant by pass of an assembler.
- Explain the need for two pass assembler.
- Explain terms such as Forward Reference and backward reference.
- Explain various types of errors that are handled in passé-I.
- Explain the need of Intermediate Code generation and the variants used. 6. State various tables used and their significance in the design of two pass Assembler. 7. What is the job of assembler?
- What are the various data structures used for implementing Pass-I of a two-pass assembler.
- What feature of assembly language makes it mandatory to design a two pass assembler?
- How are literals handled in an assembler?
- How assembler directives are handled in pass I of assembler? System Programming & OS Laboratory TE Computer Engineering (2019 Course) **Group - A Assignment No. 2
- Title:** Implement Pass-II of two pass assembler for pseudo-machine in Java using object oriented features. The output of assignment-1 (intermediate file and symbol table) should be input for this assignment. 2. Objectives:
- To understand data structures to be used in pass II of an assembler.
- To implement pass I of an assembler
3. Problem Statement: Write a program to create pass-II Assembler 4. Outcomes: After completion of this assignment students will be able to: - Understand the concept of Pass-II Assembler - Understand the Programming language of Java 5. Software Requirements: ∙ Linux OS, JDK1. 6. Hardware Requirement:
- 4GB RAM ,500GB HDD 7. Theory Concepts: Design of a Two Pass Assembler: - Tasks performed by the passes of two-pass assembler are as follows: Pass I: - Separate the symbol, mnemonic opcode and operand fields. Determine the storage-required foe every assembly language statement and update the location counter. Build the symbol table and the literal table. Construct the intermediate code for every assembly language statement. System Programming & OS Laboratory TE Computer Engineering (2019 Course) Pass II: - Synthesize the target code by processing the intermediate code generated during pass1 Data Structure used by Pass II:
- OPTAB: A table of mnemonic opcodes and related information.
- SYMTAB: The symbol table
- POOL_TAB and LITTAB: A table of literals used in the program
- Intermediate code generated by Pass I
- Output file containing Target code / error listing. Algorithms(procedure) :
library application for arithmetic operation References: J. J. Donovan, “Systems Programming”, McGraw Hill.[ chapter 3 ] Oral Questions: [Write short answer]
- Explain various types of errors that are handled in passé-II.
- Write algorithm of passé-II.
- Draw flowchart of passé-II.
- State various tables used and their significance in the design of two pass Assembler.
- How LTORG statement is handled in pass II of assembler?
- How Declarative statement is handled in pass II of assembler?
- What is the significance of pool table?
- Which data structures of pass I are used in pass II of assembler?
- Explain the handling of imperative statement.
- What feature of assembly language makes it mandatory to design a two pass assembler?
- How are literals handled in an assembler?
- How assembler directives are handled in pass I of assembler? System Programming & OS Laboratory TE Computer Engineering (2019 Course) **Group - A Assignment No. 3
- Title:** Design suitable data structures and implement pass-I of a two-pass macro-processor using OOP features in Java 2. Objectives:
- To Identify and create the data structures required in the design of macro processor. - To Learn parameter processing in macro
- To implement pass I of macroprocessor 3. Problem Statement: Write a program to create pass-I Macro-processor 4. Outcomes: After completion of this assignment students will be able to:
- Understand the Programming language of Java
- Understand the concept of Pass-I Macro-processor 5. Software Requirements: □ Linux OS, JDK1. 6. Hardware Requirement:
- 4GB RAM ,500GB HDD
7. Theory Concepts: MACRO Macro allows a sequence of source language code to be defined once & then referred to by name each time it is to be referred. Each time this name occurs is a program the sequence of codes is substituted at that point. A macro consist of
- Name of the macro
- Set of parameters
- Body of macro System Programming & OS Laboratory TE Computer Engineering (2019 Course) Macros are typically defined at the start of program. Macro definition consists of
- MACRO pseudo
- MACRO name
- Sequence of statements
- MEND pseudo opcode terminating A macro is called by writing the macro name with actual parameter is an assembly program. The macro call has following syntax . MACRO PROCESSOR MACRO PROCESSOR Prog with macro ASSMBLER Target Prog defination Fig 1. Assembly language program without macro Macro processor takes a source program containing macro definition & macro calls and translates into an assembly language program without any macro definition or calls. This program can now be handled over to a conventional assembler to obtain the target language.
MDT: Sr. No MACRO STATEMENT ALA: Index Argument System Programming & OS Laboratory TE Computer Engineering (2019 Course) Specification of Data Bases Pass 1 data bases
- The input macro source desk.
- The output macro source desk copy for use by passes 2.
- The macro definition table (MDT) used to store the names of defined macros.
- Macro name table (MDT) used to stare the name of defined macros.
- The Macro definition table counter used to indicate the next available entry in MNT.
- The macro name table counter counter(MNTC) used to indicate next available entry in MNT.
- The arguments list array (ALA) used to substitute index markers for dummy arguments before starting a macro definition. Conclusion: Thus we have successfully implemented pass-I of a two-pass Macro-processor. References: J. J. Donovan, “Systems Programming”, McGraw Hill[chapter 4 topic 4.0, 4.1, 4.3, 4.3. figure 4.1] Oral Questions: [Write short answer]
- What are macros? Why do we need macros?
- Explain data structures that are used for implementing Pass I of a macro processor. 3. Explain the macro assembler facilities such as Nested Macro, Labels within Macro, Macro Parameters.
- What are the contents of MDT and MNT?
- Explain the algorithm of pass I of macro processor System Programming & OS Laboratory TE Computer Engineering (2019 Course) **Group - A Assignment No. 4
- Title:** Write a Java program for pass-II of a two-pass macro-processor. The output of assignment 3 (MNT, MDT and file without any macro definitions) should be input for this assignment. 2. Objectives:
- To Identify and create the data structures required in the design of macro processor. - To Learn parameter processing in macro
- To implement pass II of macroprocessor 3. Problem Statement: Write a program to create pass-II Macro-processor 4. Outcomes: After completion of this assignment students will be able to:
- Understand the Programming language of Java
- Understand the concept of Pass-II Macro-processor 5. Software Requirements: ∙ Linux OS, JDK1. 6. Hardware Requirement:
- 4GB RAM ,500GB HDD 7.Theory Concepts: Pass II: Replace every occurrence of macro call with macro definition. (Expanded Code) There are four basic tasks that any macro instruction process must perform: 1. Recognize macro definition: A macro instruction processor must recognize macro definition identified by the MACRO and MEND pseudo-ops. This tasks can be complicated when macro definition appears within macros. When MACROs and MENDs are nested, as the macro processor must recognize the nesting and correctly match the last or or outer MEND with first MACRO. All intervening text, including nested MACROs
- The output expanded source deck to be used as input to the assembler System Programming & OS Laboratory TE Computer Engineering (2019 Course)
- The Macro Definition Table (MDT), created by pass 1
- The Macro Name Table (MNT), created by pass 1
- The Macro Definition Table Counter (MNTC), used to indicate the next line of text to be used during macro expansion
- The Argument List Array (ALA), used to substitute macro call arguments for the index markers in stored macro definition 9. Conclusion: Thus we have successfully implemented pass-II of a two-pass macro-processor References: J. J. Donovan, “Systems Programming”, McGraw Hill[chapter 4 ] Oral Questions: [Write short answer]
- Write an algorithm for PASS-II of a two pass macro processor.
- Explain macro expansion.
- Draw flowchart of PASS-II of a two pass macro processor.
- Explain nested Macro calls
- Explain data structures that are used for implementing Pass II of a macro processor.
- What is the input and output of pass II of macro processor?
- What functions are involved in pass II of macro processor?
- What is Conditional Macro Expansion?
- Explain the contents of all the tables of pass II of macro processor. System Programming & OS Laboratory TE Computer Engineering (2019 Course) **Group - B Assignment No. 1
- Title:** Write a program to create Dynamic Link Library for any mathematical operation and write an application program to test it. (Java Native Interface / Use VB or VC++). 2. Objectives:
- To understand Dynamic Link Libraries Concepts
- To implement dynamic link library concepts
- To study about Visual Basic 3. Problem Statement:
Write a program to create Dynamic Link Library for Arithmetic Operation in VB.net
4. Outcomes: After completion of this assignment students will be able to:
- Understand the concept of Dynamic Link Library
- Understand the Programming language of Visual basic 5. Software Requirements: ∙ Visual Studio 2010 6. Hardware Requirement: - M/C Lenovo Think center M700 Ci3,6100,6th Gen. H81, 4GB RAM ,500GB HDD 7. Theory Concepts: Dynamic Link Library: A dynamic link library (DLL) is a collection of small programs that can be loaded when needed by larger programs and used at the same time. The small program lets the larger program communicate with a specific device, such as a printer or scanner. It is often packaged as a DLL program, which is usually referred to as a DLL file. DLL files that support specific device operation are known as device drivers. A DLL file is often given a ".dll" file name suffix. DLL files are dynamically linked with the program that uses them during program execution rather than being compiled into the main program. The advantage of DLL files is space is saved in random access memory (RAM) because the files don't get loaded into RAM together with the main program. When a DLL file is needed, it is loaded and run. For example, as long as a user is editing a document in Microsoft Word, the printer DLL file does not need to be loaded into RAM. If the user decides to print the document, the Word application causes the printer DLL file to be loaded and run. System Programming & OS Laboratory TE Computer Engineering (2019 Course) A program is separated into modules when using a DLL. With modularized components, a program can be sold by module, have faster load times and be updated without altering other parts of the program. DLLs help operating systems and programs run faster, use memory efficiently and take up less disk space. Feature of DLL: - DLLs are essentially the same as EXEs, the choice of which to produce as part of the linking process is for clarity, since it is possible to export functions and data from either. - It is not possible to directly execute a DLL, since it requires an EXE for the operating system to load it through an entry point, hence the existence of utilities like RUNDLL.EXE or RUNDLL32.EXE which provide the entry point and minimal framework for DLLs that contain enough functionality to execute without much support. - DLLs provide a mechanism for shared code and data, allowing a developer of shared code/data to upgrade functionality
(the required stack space). As a result, the function when declared as: int stdcall func (int a, double b) is decorated as: _func@ The C calling convention ( cdecl) decorates the name as _func. To get the decorated name, use /MAP. Use of declspec(dllexport) does the following: - If the function is exported with the C calling convention ( _cdecl ), it strips the leading underscore (_) when the name is exported.
- If the function being exported does not use the C calling convention (for example, stdcall), it exports the decorated name. Because there is no way to override where the stack cleanup occurs, you must use stdcall. To undecorate names with stdcall, you must specify them by using aliases in the EXPORTS section of the .def file. This is shown as follows for the following function declaration: int stdcall MyFunc (int a, double b); void stdcall InitCode (void); In the .DEF file: EXPORTS MYFUNC=_MyFunc@ INITCODE=_InitCode@ System Programming & OS Laboratory TE Computer Engineering (2019 Course) For DLLs to be called by programs written in Visual Basic, the alias technique shown in this topic is needed in the .def file. If the alias is done in the Visual Basic program, use of aliasing in the .def file is not necessary. It can be done in the Visual Basic program by adding an alias clause to the Declare statement. DLL’s Advantages:
- Saves memory and reduces swapping. Many processes can use a single DLL simultaneously, sharing a single copy of the DLL in memory. In contrast, Windows must load a copy of the library code into memory for each application that is built with a static link library.
- Saves disk space. Many applications can share a single copy of the DLL on disk. In contrast, each application built with a static link library has the library code linked into its executable image as a separate copy.
- Upgrades to the DLL are easier. When the functions in a DLL change, the applications that use them do not need to be recompiled or relinked as long as the function arguments and return values do not change. In contrast, statically linked object code requires that the application be relinked when the functions change.
- Provides after-market support. For example, a display driver DLL can be modified to support a display that was not available when the application was shipped. - Supports multi language programs. Programs written in different programming languages can call the same DLL function as long as the programs follow the function's calling convention. The programs
and the DLL function must be compatible in the following ways: the order in which the function expects its arguments to be pushed onto the stack, whether the function or the application is responsible for cleaning up the stack, and whether any arguments are passed in registers.
- Provides a mechanism to extend the MFC library classes. You can derive classes from the existing MFC classes and place them in an MFC extension DLL for use by MFC applications.
- Eases the creation of international versions. By placing resources in a DLL, it is much easier to create international versions of an application. You can place the strings for each language version of your application in a separate resource DLL and have the different language versions load the appropriate resources. Disadvantage:
- A potential disadvantage to using DLLs is that the application is not self-contained; it depends on the existence of a separate DLL module. Visual Basic: Visual Basic is a third-generation event-driven programming language first released by Microsoft in 1991. It evolved from the earlier DOS version called BASIC. BASIC means B eginners' A ll- purpose S ymbolic I nstruction C ode. Since then Microsoft has released many versions of Visual Basic, from Visual Basic 1.0 to the final version Visual Basic 6.0. Visual System Programming & OS Laboratory TE Computer Engineering (2019 Course) Basic is a user-friendly programming language designed for beginners, and it enables anyone to develop GUI window applications easily. In 2002, Microsoft released Visual Basic.NET (VB.NET) to replace Visual Basic 6. Thereafter, Microsoft declared VB6 a legacy programming language in 2008. Fortunately, Microsoft still provides some form of support for VB6. VB.NET is a fully object-oriented programming language implemented in the .NET Framework. It was created to cater for the development of the web as well as mobile applications. However, many developers still favor Visual Basic 6.0 over its successor Visual Basic.NET **. Design (architecture):
- Algorithms(procedure) :**