SlideShare a Scribd company logo
1 of 23
Download to read offline
ECET 360 Hands On Exercise 4
To Purchase This Material Click below Link
For more classes visit
www.snaptutorial.com
Advanced C Programming
You are required to study and understand the under lying concepts of
advanced C used in the examples below. You are also required to
compile and execute the programs and capture the output generated by
each program
1. A Simple C program with more than one function (Parameters passed
by value)
2. Basic concepts of Pointers in C
The following program demonstrates about the pointer variable, * and &
operators.
3. Passing parameters to function by pointers
4. Using Structures in C
5. Structures
Structure is a collection / group of different / same variables.
Example:
-----------------------------------------------------
ECET 360 Hands On Exercise 5
To Purchase This Material Click below Link
For more classes visit
www.snaptutorial.com
Objective:
This hands on exercise examines aspects of threads and multiprocessing
(and multithreading). The primary objective of this exercise is to
implement the Thread Management Functions:
Creating Threads
Terminating Thread Execution
Thread Identifiers
Joining Threads
Detaching / Undetaching Threads
-----------------------------------------------------
ECET 360 Hands On Exercise 7
To Purchase This Material Click below Link
For more classes visit
www.snaptutorial.com
Objectives:
In this hands on exercise, we will use semaphore to solve various
synchronization problems. Semaphores are counters for resources
shared between processes/threads. The basic operations on semaphores
are: increment the counter atomically, and wait until the counter is non-
null and decrement it atomically.
This exercise has two primary objectives:
How to use semaphore to solve various synchronization problems
Implementing the POSIX.1b semaphore functions which include
™ Initializing semaphores
™ Decreasing the count of a semaphore.
™ Increasing the count of a semaphore.
™ Destroying semaphores.
-----------------------------------------------------
ECET 360 Week 2 iLab
To Purchase This Material Click below Link
For more classes visit
www.snaptutorial.com
Accessing Your Lab
To access your labs after you've logged in, apply the following steps:
Click the Professional Development tab located on the top of the page.
Select "Development Paths".
You will see the course that you are taking listed on this page.
Click the course to see the labs.
Starting Your Lab
There are two ways to start a lab activity:
Schedule It. (Recommended)
Because you have access to live equipment, there is only a defined
number of students who can use any one lab at any given time. It is
recommended to schedule your labs to make sure the lab is available to
you at your convenience. If you try to log into a lab and the access is
denied, the system will let you schedule the lab at a later date.
Start it right away.
L A B O V E R V I E W
Scenario/Summary
Process Management Simulation (Part 2 of 3)
The objective of this three section lab is to simulate four process
management functions: process creation, replacing the current process
image with a new process image, process state transition, process
scheduling.
This lab will be due over the first three weeks of this course. The
commander process program is due in week 1. This program will
introduce the student to system calls and other basic operating system
functions. The process manager functions: process creation, replacing
the current process image with a new process image andprocess state
transition, are due in week 2. The scheduling section of the process
manager is due in week 3.
You will use Linux system calls such as fork( ), exec(), wait( ), pipe( ),
and sleep( ). Read man pages of these system calls for details.
This simulation exercise consists of three processes running on a Linux
environment: commander, process manager, andreporter. There is one
commander process (this is the process that starts your simulation), one
process manager process that is created by the commander process, and
a number of reporter processes that get created by the process manager,
as needed.
1. Commander Process:
The commander process first creates a pipe and then the process
manager process. It then repeatedly reads commands from the standard
input and passes them to the process manager process via the pipe. The
commander process accepts four commands:
1. Q: End of one unit of time.
2. U: Unblock the first simulated process in blocked queue.
3. P: Print the current state of the system.
4. T: Print the average turnaround time, and terminate the system.
Command T can only be executed once.
1.1 Simulated Process:
Process management simulation manages the execution of simulated
processes. Each simulated process is comprised of a program that
manipulates the value of a single integer variable. Thus the state of a
simulated process at any instant is comprised of the value of its integer
variable and the value of its program counter.
A simulated process™ program consists of a sequence of instructions.
There are seven types of instructions as follows:
1. S n: Set the value of the integer variable to n, where n is an integer.
2. A n: Add n to the value of the integer variable, where n is an integer.
3. D n: Subtract n from the value of the integer variable, where n is an
integer.
4. B: Block this simulated process.
5. E: Terminate this simulated process.
6. F n: Create a new simulated process. The new (simulated) process is
an exact copy of the parent (simulated) process. The new (simulated)
process executes from the instruction immediately after this (F)
instruction, while the parent (simulated) process continues its execution
n instructions after the next instruction.
7. R filename: Replace the program of the simulated process with the
program in the file filename, and set program counter to the first
instruction of this new program.
An example of a program for a simulated process is as follows:
S 1000
A 19
A 20
D 53
A 55
F 1
R file_a
F 1
R file_b
F 1
R file_c
F 1
R file_d
F 1
R file_e
E
You may store the program of a simulated process in an array, with one
array entry for each instruction.
2. Process Manager Process:
The process manager process simulates four process management
functions: creation of new (simulated) processes,replacing the current
process image of a simulated process with a new process
image,management of process state transitions, andprocess scheduling.
In addition, it spawns a reporter process whenever it needs to print out
the state of the system.
The process manager creates the first simulated process (process id = 0)
program from an input file (filename: init). This is the only simulated
process created by the process manager on its own. All other simulated
processes are created in response to the execution of the F instruction
(read from the simulated processes).
2.1 Data structures:
The process manager maintains six data structures: Time, Cpu, PcbTable,
ReadyState, BlockedState, and RunningState.
Time is an integer variable initialized to zero.
Cpu is used to simulate the execution of a simulated process that is in
running state. It should include data members to store a pointer to the
program array, current program counter value, integer value, and time
slice of that simulated process. In addition, it should store the number of
time units used so far in the current time slice.
PcbTable is an array with one entry for every simulated process that
hasn't finished its execution yet. Each entry should include data
members to store process id, parent process id, a pointer to program
counter value (initially 0), integer value, priority, state, start time, and
CPU time used so far.
ReadyState stores all simulated processes (PcbTable indices) that are
ready to run. This can be implemented using a queue or priority queue
data structure.
BlockedState stores all processes (PcbTable indices) that are currently
blocked. This can be implemented using a queue data structure.
RunningState stores the PcbTable index of the currently running
simulated process.
2.2 Processing input commands:
After creating the first process and initializing all its data structures, the
process manager repeatedly receives and processes one command at a
time from the commander process (read via the pipe). On receiving a Q
command, the process manager executes the next instruction of the
currently running simulated process, increments program counter value
(except for F or R instructions), increments Time, and then performs
scheduling. Note that scheduling may involve performing context
switching.
On receiving a U command, the process manager moves the first
simulated process in the blocked queue to the ready state queue array.
On receiving a P command, the process manager spawns a new reporter
process. On receiving a T command, the process manager first spawns a
reporter process and then terminates after termination of the reporter
process. The process manager ensures that no more than one reporter
process is running at any moment.
2.3 Executing simulated processes:
The process manager executes the next instruction of the currently
running simulated process on receiving a Qcommand from the
commander process. Note that this execution is completely confined to
the Cpu data structure, i.e. PcbTable is not accessed.
Instructions S, A and D update the integer value stored in Cpu.
Instruction B moves the currently running simulated process to the
blocked state and moves a process from the ready state to the running
state. This will result in a context switch. InstructionEterminates the
currently running simulated process, frees up all memory (e.g. program
array) associated with that process and updates the PcbTable. A
simulated process from the ready state is moved to running state. This
also results in a context switch.
Instruction F results in the creation of a new simulated process. A new
entry is created in the PcbTable for this new simulated process. A new
(unique) process id is assigned and the parent process id is process id of
the parent simulated process. Start time is set to the current Time value
and CPU time used so far is set to 0. The program array and integer
value of the new simulated process are a copy of the program array and
integer value of the parent simulated process. The new simulated process
has the same priority as the parent simulated process. The program
counter value of the new simulated process is set to the instruction
immediately after the Finstruction, while the program counter value of
the of the parent simulated process is set to n instructions after the next
instruction (instruction immediately after F). The new simulated process
is created in the ready state.
Finally, the R instruction results in replacing the process image of the
currently running simulated process. Its program array is overwritten by
the code in file filename, program counter value is set to 0, and integer
value is undefined. Note that all these changes are made only in the Cpu
data structure. Process id, parent process id, start time, CPU time used so
far, state, and priority remain unchanged.
2.4 Scheduling
The process manager also implements a scheduling policy. You may
experiment with a scheduling policy of multiple queues with priority
classes. In this policy, the first simulated process (created by the process
manager) starts with priority 0 (highest priority). There are a maximum
of four priority classes. Time slice (quantum size) for priority class 0 is 1
unit of time; time slice for priority class 1 is 2 units of time; time slice
for priority class 2 is 4 units of time; and time slice for priority class 3 is
8 units of time. If a running process uses its time slice completely, it is
preempted and its priority is lowered. If a running process blocks before
its allocated quantum expires, its priority is raised.
3. Reporter Process
The reporter process prints the current state of the system on the
standard output and then terminates. The output from the reporter
process appears as follows:
**********************************************************
******
The current system state is as follows:
**********************************************************
******
CURRENT TIME: time
RUNNING PROCESS:
pid, ppid, priority, value, start time, CPU time used so far
BLOCKED PROCESSES:
Queue of blocked processes:
pid, ppid, priority, value, start time, CPU time used so far
¦
pid, ppid, priority, value, start time, CPU time used so far
PROCESSES READY TO EXECUTE:
Queue of processes with priority 0:
pid, ppid, value, start time, CPU time used so far
pid, ppid, value, start time, CPU time used so far
¦
¦
Queue of processes with priority 3:
pid, ppid, value, start time, CPU time used so far
pid, ppid, value, start time, CPU time used so far
**********************************************************
******
Deliverables
You will submit to the dropbox, for week 2, three separate files:
C or C++ program (source code)
Executable file (object), and
Instructions to execute the program
L A B S T E P S
Process Manager (50 points)
The program for the process manager functions: process creation,
replacing the current process image with a new process image and
process state transition, are due this week. This program is to be written
in C or C++ programming languages on a Linux environment.
IMPORTANT: Please make sure that any question or clarification about
these labs are addressed early.
2. Process Manager Process:
The process manager process simulates four process management
functions: creation of new (simulated) processes,replacing the current
process image of a simulated process with a new process
image,management of process state transitions, andprocess scheduling.
In addition, it spawns a reporter process whenever it needs to print out
the state of the system.
The process manager creates the first simulated process (process id = 0)
program from an input file (filename: init). This is the only simulated
process created by the process manager on its own. All other simulated
processes are created in response to the execution of the F instruction
(read from the simulated processes).
2.1 Data structures:
The process manager maintains six data structures: Time, Cpu, PcbTable,
ReadyState, BlockedState, and RunningState.
Time is an integer variable initialized to zero.
Cpu is used to simulate the execution of a simulated process that is in
running state. It should include data members to store a pointer to the
program array, current program counter value, integer value, and time
slice of that simulated process. In addition, it should store the number of
time units used so far in the current time slice.
PcbTable is an array with one entry for every simulated process that
hasn't finished its execution yet. Each entry should include data
members to store process id, parent process id, a pointer to program
counter value (initially 0), integer value, priority, state, start time, and
CPU time used so far.
ReadyState stores all simulated processes (PcbTable indices) that are
ready to run. This can be implemented using a queue or priority queue
data structure.
BlockedState stores all processes (PcbTable indices) that are currently
blocked. This can be implemented using a queue data structure.
RunningState stores the PcbTable index of the currently running
simulated process.
2.2 Processing input commands:
After creating the first process and initializing all its data structures, the
process manager repeatedly receives and processes one command at a
time from the commander process (read via the pipe). On receiving a Q
command, the process manager executes the next instruction of the
currently running simulated process, increments program counter value
(except for F or R instructions), increments Time, and then performs
scheduling. Note that scheduling may involve performing context
switching.
On receiving a U command, the process manager moves the first
simulated process in the blocked queue to the ready state queue array.
On receiving a P command, the process manager spawns a new reporter
process. On receiving a T command, the process manager first spawns a
reporter process and then terminates after termination of the reporter
process. The process manager ensures that no more than one reporter
process is running at any moment.
2.3 Executing simulated processes:
The process manager executes the next instruction of the currently
running simulated process on receiving a Qcommand from the
commander process. Note that this execution is completely confined to
the Cpu data structure, i.e. PcbTable is not accessed.
Instructions S, A and D update the integer value stored in Cpu.
Instruction B moves the currently running simulated process to the
blocked state and moves a process from the ready state to the running
state. This will result in a context switch. InstructionEterminates the
currently running simulated process, frees up all memory (e.g. program
array) associated with that process and updates the PcbTable. A
simulated process from the ready state is moved to running state. This
also results in a context switch.
Instruction F results in the creation of a new simulated process. A new
entry is created in the PcbTable for this new simulated process. A new
(unique) process id is assigned and the parent process id is process id of
the parent simulated process. Start time is set to the current Time value
and CPU time used so far is set to 0. The program array and integer
value of the new simulated process are a copy of the program array and
integer value of the parent simulated process. The new simulated process
has the same priority as the parent simulated process. The program
counter value of the new simulated process is set to the instruction
immediately after the Finstruction, while the program counter value of
the of the parent simulated process is set to n instructions after the next
instruction (instruction immediately after F). The new simulated process
is created in the ready state.
Finally, the R instruction results in replacing the process image of the
currently running simulated process. Its program array is overwritten by
the code in file filename, program counter value is set to 0, and integer
value is undefined. Note that all these changes are made only in the Cpu
data structure. Process id, parent process id, start time, CPU time used so
far, state, and priority remain unchanged.
1.1 Simulated Process:
Additional Information for the Process Manager:
Process management simulation manages the execution of simulated
processes. Each simulated process is comprised of a program that
manipulates the value of a single integer variable. Thus the state of a
simulated process at any instant is comprised of the value of its integer
variable and the value of its program counter.
A simulated process™ program consists of a sequence of instructions.
There are seven types of instructions as follows:
1. S n: Set the value of the integer variable to n, where n is an integer.
2. A n: Add n to the value of the integer variable, where n is an integer.
3. D n: Subtract n from the value of the integer variable, where n is an
integer.
4. B: Block this simulated process.
5. E: Terminate this simulated process.
6. F n: Create a new simulated process. The new (simulated) process is
an exact copy of the parent (simulated) process. The new (simulated)
process executes from the instruction immediately after this (F)
instruction, while the parent (simulated) process continues its execution
n instructions after the next instruction.
7. R filename: Replace the program of the simulated process with the
program in the file filename, and set program counter to the first
instruction of this new program.
An example of a program for a simulated process is as follows:
S 1000
A 19
A 20
D 53
A 55
F 1
R file_a
F 1
R file_b
F 1
R file_c
F 1
R file_d
F 1
R file_e
E
You may store the program of a simulated process in an array, with one
array entry for each instruction.
-----------------------------------------------------
ECET 360 Week 4 iLab
To Purchase This Material Click below Link
For more classes visit
www.snaptutorial.com
The objective of this week's lab is to simulate and evaluate different
memory allocation/deallocation techniques (first fit,next fit, best fit, and
worst fit)when a linked list is used to keep track of memory usage.You
will implement a separate Memory component for TWO of the four
memory allocation/deallocation techniques. This lab is designed to be
completed in two weeks. One allocation/deallocation technique is due on
Week 4, and the second technique is due on Week 5.
Assume that the memory is 256 KB and is divided into units of 2 KB
each. A process may request between 3 and 10 units of memory. Your
simulation consists of three components: a Memorycomponent that
implements a specific allocation/deallocation technique, arequest
generation component that generates allocation/deallocation requests,
and a statisticsreportingcomponent that prints out the relevant statistics.
The Memory component exports the following functions:
int allocate_mem(int process_id, int num_units): allocates num_units
units of memory to a process whose id is process_id. If successful, it
returns the number of nodes traversed in the linked list. Otherwise, it
returns -1.
int deallocate_mem(int process_id): deallocates the memory allocated to
the process whose ID is process_id. It returns 1, if successful, otherwise
“1.
int fragment_count( ): returns the number of holes (fragments of sizes 1
or 2 units).
The request generation component generates allocation and deallocation
requests. For allocation requests, the component specifies the process ID
of the process for which memory is requested as well as the number of
memory units being requested. For this simulation, assume that memory
is requested for each process only once. For deallocation requests, the
component specifies the process ID of the process whose memory has to
be deallocated. For this simulation, assume that the entire memory
allocated to a process is deallocated on a deallocation request. You may
generate these requests based on some specific criteria, e.g., at random
or from a memory allocation/deallocation trace obtained from some
source.
There are three performance parameters that your simulation should
calculate for the chosen two techniques: average number of external
fragments, average allocation time in terms of the average number of
nodes traversed in allocation, and the percentage of times an allocation
request is denied.
Generate 10,000 requests using the request generation component, and
for each request, invoke the appropriate function of the Memory
component for each of the memory allocation/deallocation techniques.
After every request, update the three performance parameters for each of
the techniques. The statistics reporting component prints the value of the
three parameters for the two techniques at the end.
You will submit four separate files to the dropbox for Week 4:
C or C++ program (source code)
Executable file (object)
Instructions to execute the program
Analysis of the results for the chosen allocation/deallocation technique
-----------------------------------------------------
ECET 360 Week 5 Lab Memory Management II
To Purchase This Material Click below Link
For more classes visit
www.snaptutorial.com
Objective
To write a C program to implement memory management using
segmentation.
ALGORITHM:
Step1 : Start the program.
Step2 : Read the base address, number of segments, size of each
segment, memory limit.
Step3 : If memory address is less than the base address display “invalid
memory limit”.
Step4 : Create the segment table with the segment number and segment
address and display it.
Step5 : Read the segment number and displacement.
Step6 : If the segment number and displacement is valid compute the
real address and display the same.
Step7 : Stop the program
-----------------------------------------------------
ECET 360 Week 6 and 7 Lab
To Purchase This Material Click below Link
For more classes visit
www.snaptutorial.com
Write a C program to simulate the shortest job first algorithm with
preemption.
DESCRIPTION:
For implementing SJF algorithm with preemption, we consider the
arrival
times of each process, the burst times of all the previously arrived
processes.
After the arrival of all the processes into the ready queue, the average
waiting
time and turn around time can be calculated by using the above
algorithm.
-----------------------------------------------------

More Related Content

What's hot

Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Mukesh Chinta
 
Programming using MPI and OpenMP
Programming using MPI and OpenMPProgramming using MPI and OpenMP
Programming using MPI and OpenMPDivya Tiwari
 
Emulation Error Recovery
Emulation Error RecoveryEmulation Error Recovery
Emulation Error Recoverysomnathb1
 
Real-Time Scheduling Algorithms
Real-Time Scheduling AlgorithmsReal-Time Scheduling Algorithms
Real-Time Scheduling AlgorithmsAJAL A J
 
Slides For Operating System Concepts By Silberschatz Galvin And Gagne
Slides For Operating System Concepts By Silberschatz Galvin And GagneSlides For Operating System Concepts By Silberschatz Galvin And Gagne
Slides For Operating System Concepts By Silberschatz Galvin And Gagnesarankumar4445
 
Process synchronization in Operating Systems
Process synchronization in Operating SystemsProcess synchronization in Operating Systems
Process synchronization in Operating SystemsRitu Ranjan Shrivastwa
 
Process and Threads in JAVA
Process and Threads in JAVAProcess and Threads in JAVA
Process and Threads in JAVArahul tamrkar
 
Operating system 29 non preemptive scheduling
Operating system 29 non preemptive schedulingOperating system 29 non preemptive scheduling
Operating system 29 non preemptive schedulingVaibhav Khanna
 
Uvm presentation dac2011_final
Uvm presentation dac2011_finalUvm presentation dac2011_final
Uvm presentation dac2011_finalsean chen
 
Real-Time Scheduling
Real-Time SchedulingReal-Time Scheduling
Real-Time Schedulingsathish sak
 
Process Synchronization
Process SynchronizationProcess Synchronization
Process SynchronizationShipra Swati
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.Ravi Kumar Patel
 

What's hot (18)

Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)
 
Programming using MPI and OpenMP
Programming using MPI and OpenMPProgramming using MPI and OpenMP
Programming using MPI and OpenMP
 
Process scheduling
Process schedulingProcess scheduling
Process scheduling
 
Emulation Error Recovery
Emulation Error RecoveryEmulation Error Recovery
Emulation Error Recovery
 
Real-Time Scheduling Algorithms
Real-Time Scheduling AlgorithmsReal-Time Scheduling Algorithms
Real-Time Scheduling Algorithms
 
Java multi thread programming on cmp system
Java multi thread programming on cmp systemJava multi thread programming on cmp system
Java multi thread programming on cmp system
 
Slides For Operating System Concepts By Silberschatz Galvin And Gagne
Slides For Operating System Concepts By Silberschatz Galvin And GagneSlides For Operating System Concepts By Silberschatz Galvin And Gagne
Slides For Operating System Concepts By Silberschatz Galvin And Gagne
 
Real Time System
Real Time SystemReal Time System
Real Time System
 
Process synchronization in Operating Systems
Process synchronization in Operating SystemsProcess synchronization in Operating Systems
Process synchronization in Operating Systems
 
scheduling
schedulingscheduling
scheduling
 
Process and Threads in JAVA
Process and Threads in JAVAProcess and Threads in JAVA
Process and Threads in JAVA
 
Operating system 29 non preemptive scheduling
Operating system 29 non preemptive schedulingOperating system 29 non preemptive scheduling
Operating system 29 non preemptive scheduling
 
Ch5 answers
Ch5 answersCh5 answers
Ch5 answers
 
Uvm presentation dac2011_final
Uvm presentation dac2011_finalUvm presentation dac2011_final
Uvm presentation dac2011_final
 
3.1
3.13.1
3.1
 
Real-Time Scheduling
Real-Time SchedulingReal-Time Scheduling
Real-Time Scheduling
 
Process Synchronization
Process SynchronizationProcess Synchronization
Process Synchronization
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.
 

Similar to ECET 360 help A Guide to career/Snaptutorial

Ecet 360 Success Begins / snaptutorial.com
Ecet 360  Success Begins / snaptutorial.comEcet 360  Success Begins / snaptutorial.com
Ecet 360 Success Begins / snaptutorial.comWilliamsTaylorzl
 
Ecet 360 Massive Success / snaptutorial.com
Ecet 360 Massive Success / snaptutorial.comEcet 360 Massive Success / snaptutorial.com
Ecet 360 Massive Success / snaptutorial.comHarrisGeorgx
 
Lab 3 of 7 Process Management Simulation L A B  O V E R V I E W.docx
Lab 3 of 7 Process Management Simulation L A B  O V E R V I E W.docxLab 3 of 7 Process Management Simulation L A B  O V E R V I E W.docx
Lab 3 of 7 Process Management Simulation L A B  O V E R V I E W.docxfestockton
 
Operator Instructions Once the program is running the operator c.docx
Operator Instructions Once the program is running the operator c.docxOperator Instructions Once the program is running the operator c.docx
Operator Instructions Once the program is running the operator c.docxcherishwinsland
 
Sheet1Address60741024Offsetaddress0102450506074120484026230723002p.docx
Sheet1Address60741024Offsetaddress0102450506074120484026230723002p.docxSheet1Address60741024Offsetaddress0102450506074120484026230723002p.docx
Sheet1Address60741024Offsetaddress0102450506074120484026230723002p.docxbagotjesusa
 
Programming Assignment #2CSci 430 Spring 2019Dates.docx
Programming Assignment #2CSci 430 Spring 2019Dates.docxProgramming Assignment #2CSci 430 Spring 2019Dates.docx
Programming Assignment #2CSci 430 Spring 2019Dates.docxstilliegeorgiana
 
Programming Assignment #2CSci 430 Spring 2019Dates.docx
Programming Assignment #2CSci 430 Spring 2019Dates.docxProgramming Assignment #2CSci 430 Spring 2019Dates.docx
Programming Assignment #2CSci 430 Spring 2019Dates.docxdenneymargareta
 
Assignment 02 Process State SimulationCSci 430 Introduction to.docx
Assignment 02 Process State SimulationCSci 430 Introduction to.docxAssignment 02 Process State SimulationCSci 430 Introduction to.docx
Assignment 02 Process State SimulationCSci 430 Introduction to.docxcargillfilberto
 
SMP4 Thread Scheduler======================INSTRUCTIONS.docx
SMP4 Thread Scheduler======================INSTRUCTIONS.docxSMP4 Thread Scheduler======================INSTRUCTIONS.docx
SMP4 Thread Scheduler======================INSTRUCTIONS.docxpbilly1
 
SMP4 Thread Scheduler (PART 1)======================INSTR.docx
SMP4 Thread Scheduler (PART 1)======================INSTR.docxSMP4 Thread Scheduler (PART 1)======================INSTR.docx
SMP4 Thread Scheduler (PART 1)======================INSTR.docxpbilly1
 
Write a program in C or C++ which simulates CPU scheduling in an opera.pdf
Write a program in C or C++ which simulates CPU scheduling in an opera.pdfWrite a program in C or C++ which simulates CPU scheduling in an opera.pdf
Write a program in C or C++ which simulates CPU scheduling in an opera.pdfsravi07
 
SMP4 Thread Scheduler (PART 1)======================INS.docx
SMP4 Thread Scheduler (PART 1)======================INS.docxSMP4 Thread Scheduler (PART 1)======================INS.docx
SMP4 Thread Scheduler (PART 1)======================INS.docxpbilly1
 
NIE2206 Electronic LogbookNamexxxStudent IDUxxxTe.docx
NIE2206 Electronic LogbookNamexxxStudent IDUxxxTe.docxNIE2206 Electronic LogbookNamexxxStudent IDUxxxTe.docx
NIE2206 Electronic LogbookNamexxxStudent IDUxxxTe.docxcurwenmichaela
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAAiman Hud
 
Faster Python Programs Through Optimization by Dr.-Ing Mike Muller
Faster Python Programs Through Optimization by Dr.-Ing Mike MullerFaster Python Programs Through Optimization by Dr.-Ing Mike Muller
Faster Python Programs Through Optimization by Dr.-Ing Mike MullerPyData
 
RPG Program for Unit Testing RPG
RPG Program for Unit Testing RPG RPG Program for Unit Testing RPG
RPG Program for Unit Testing RPG Greg.Helton
 
Assignment 1 Hypothetical Machine SimulatorCSci 430 Int.docx
Assignment 1  Hypothetical Machine SimulatorCSci 430 Int.docxAssignment 1  Hypothetical Machine SimulatorCSci 430 Int.docx
Assignment 1 Hypothetical Machine SimulatorCSci 430 Int.docxjane3dyson92312
 
System Calls - Introduction
System Calls - IntroductionSystem Calls - Introduction
System Calls - IntroductionTo Sum It Up
 

Similar to ECET 360 help A Guide to career/Snaptutorial (20)

Ecet 360 Success Begins / snaptutorial.com
Ecet 360  Success Begins / snaptutorial.comEcet 360  Success Begins / snaptutorial.com
Ecet 360 Success Begins / snaptutorial.com
 
Ecet 360 Massive Success / snaptutorial.com
Ecet 360 Massive Success / snaptutorial.comEcet 360 Massive Success / snaptutorial.com
Ecet 360 Massive Success / snaptutorial.com
 
Lab 3 of 7 Process Management Simulation L A B  O V E R V I E W.docx
Lab 3 of 7 Process Management Simulation L A B  O V E R V I E W.docxLab 3 of 7 Process Management Simulation L A B  O V E R V I E W.docx
Lab 3 of 7 Process Management Simulation L A B  O V E R V I E W.docx
 
Operator Instructions Once the program is running the operator c.docx
Operator Instructions Once the program is running the operator c.docxOperator Instructions Once the program is running the operator c.docx
Operator Instructions Once the program is running the operator c.docx
 
Experimentos lab
Experimentos labExperimentos lab
Experimentos lab
 
Sheet1Address60741024Offsetaddress0102450506074120484026230723002p.docx
Sheet1Address60741024Offsetaddress0102450506074120484026230723002p.docxSheet1Address60741024Offsetaddress0102450506074120484026230723002p.docx
Sheet1Address60741024Offsetaddress0102450506074120484026230723002p.docx
 
Programming Assignment #2CSci 430 Spring 2019Dates.docx
Programming Assignment #2CSci 430 Spring 2019Dates.docxProgramming Assignment #2CSci 430 Spring 2019Dates.docx
Programming Assignment #2CSci 430 Spring 2019Dates.docx
 
Programming Assignment #2CSci 430 Spring 2019Dates.docx
Programming Assignment #2CSci 430 Spring 2019Dates.docxProgramming Assignment #2CSci 430 Spring 2019Dates.docx
Programming Assignment #2CSci 430 Spring 2019Dates.docx
 
Assignment 02 Process State SimulationCSci 430 Introduction to.docx
Assignment 02 Process State SimulationCSci 430 Introduction to.docxAssignment 02 Process State SimulationCSci 430 Introduction to.docx
Assignment 02 Process State SimulationCSci 430 Introduction to.docx
 
Lect 3-4 Zaheer Abbas
Lect 3-4 Zaheer AbbasLect 3-4 Zaheer Abbas
Lect 3-4 Zaheer Abbas
 
SMP4 Thread Scheduler======================INSTRUCTIONS.docx
SMP4 Thread Scheduler======================INSTRUCTIONS.docxSMP4 Thread Scheduler======================INSTRUCTIONS.docx
SMP4 Thread Scheduler======================INSTRUCTIONS.docx
 
SMP4 Thread Scheduler (PART 1)======================INSTR.docx
SMP4 Thread Scheduler (PART 1)======================INSTR.docxSMP4 Thread Scheduler (PART 1)======================INSTR.docx
SMP4 Thread Scheduler (PART 1)======================INSTR.docx
 
Write a program in C or C++ which simulates CPU scheduling in an opera.pdf
Write a program in C or C++ which simulates CPU scheduling in an opera.pdfWrite a program in C or C++ which simulates CPU scheduling in an opera.pdf
Write a program in C or C++ which simulates CPU scheduling in an opera.pdf
 
SMP4 Thread Scheduler (PART 1)======================INS.docx
SMP4 Thread Scheduler (PART 1)======================INS.docxSMP4 Thread Scheduler (PART 1)======================INS.docx
SMP4 Thread Scheduler (PART 1)======================INS.docx
 
NIE2206 Electronic LogbookNamexxxStudent IDUxxxTe.docx
NIE2206 Electronic LogbookNamexxxStudent IDUxxxTe.docxNIE2206 Electronic LogbookNamexxxStudent IDUxxxTe.docx
NIE2206 Electronic LogbookNamexxxStudent IDUxxxTe.docx
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
Faster Python Programs Through Optimization by Dr.-Ing Mike Muller
Faster Python Programs Through Optimization by Dr.-Ing Mike MullerFaster Python Programs Through Optimization by Dr.-Ing Mike Muller
Faster Python Programs Through Optimization by Dr.-Ing Mike Muller
 
RPG Program for Unit Testing RPG
RPG Program for Unit Testing RPG RPG Program for Unit Testing RPG
RPG Program for Unit Testing RPG
 
Assignment 1 Hypothetical Machine SimulatorCSci 430 Int.docx
Assignment 1  Hypothetical Machine SimulatorCSci 430 Int.docxAssignment 1  Hypothetical Machine SimulatorCSci 430 Int.docx
Assignment 1 Hypothetical Machine SimulatorCSci 430 Int.docx
 
System Calls - Introduction
System Calls - IntroductionSystem Calls - Introduction
System Calls - Introduction
 

Recently uploaded

DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 

Recently uploaded (20)

DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 

ECET 360 help A Guide to career/Snaptutorial

  • 1. ECET 360 Hands On Exercise 4 To Purchase This Material Click below Link For more classes visit www.snaptutorial.com Advanced C Programming You are required to study and understand the under lying concepts of advanced C used in the examples below. You are also required to compile and execute the programs and capture the output generated by each program
  • 2. 1. A Simple C program with more than one function (Parameters passed by value) 2. Basic concepts of Pointers in C The following program demonstrates about the pointer variable, * and & operators. 3. Passing parameters to function by pointers 4. Using Structures in C 5. Structures Structure is a collection / group of different / same variables. Example: ----------------------------------------------------- ECET 360 Hands On Exercise 5 To Purchase This Material Click below Link For more classes visit www.snaptutorial.com
  • 3. Objective: This hands on exercise examines aspects of threads and multiprocessing (and multithreading). The primary objective of this exercise is to implement the Thread Management Functions: Creating Threads Terminating Thread Execution Thread Identifiers Joining Threads Detaching / Undetaching Threads ----------------------------------------------------- ECET 360 Hands On Exercise 7 To Purchase This Material Click below Link
  • 4. For more classes visit www.snaptutorial.com Objectives: In this hands on exercise, we will use semaphore to solve various synchronization problems. Semaphores are counters for resources shared between processes/threads. The basic operations on semaphores are: increment the counter atomically, and wait until the counter is non- null and decrement it atomically. This exercise has two primary objectives: How to use semaphore to solve various synchronization problems Implementing the POSIX.1b semaphore functions which include
  • 5. ™ Initializing semaphores ™ Decreasing the count of a semaphore. ™ Increasing the count of a semaphore. ™ Destroying semaphores. ----------------------------------------------------- ECET 360 Week 2 iLab To Purchase This Material Click below Link For more classes visit www.snaptutorial.com
  • 6. Accessing Your Lab To access your labs after you've logged in, apply the following steps: Click the Professional Development tab located on the top of the page. Select "Development Paths". You will see the course that you are taking listed on this page. Click the course to see the labs. Starting Your Lab There are two ways to start a lab activity: Schedule It. (Recommended)
  • 7. Because you have access to live equipment, there is only a defined number of students who can use any one lab at any given time. It is recommended to schedule your labs to make sure the lab is available to you at your convenience. If you try to log into a lab and the access is denied, the system will let you schedule the lab at a later date. Start it right away. L A B O V E R V I E W Scenario/Summary Process Management Simulation (Part 2 of 3) The objective of this three section lab is to simulate four process management functions: process creation, replacing the current process image with a new process image, process state transition, process scheduling. This lab will be due over the first three weeks of this course. The commander process program is due in week 1. This program will introduce the student to system calls and other basic operating system functions. The process manager functions: process creation, replacing the current process image with a new process image andprocess state transition, are due in week 2. The scheduling section of the process manager is due in week 3. You will use Linux system calls such as fork( ), exec(), wait( ), pipe( ), and sleep( ). Read man pages of these system calls for details. This simulation exercise consists of three processes running on a Linux environment: commander, process manager, andreporter. There is one commander process (this is the process that starts your simulation), one process manager process that is created by the commander process, and a number of reporter processes that get created by the process manager, as needed. 1. Commander Process: The commander process first creates a pipe and then the process manager process. It then repeatedly reads commands from the standard input and passes them to the process manager process via the pipe. The commander process accepts four commands: 1. Q: End of one unit of time.
  • 8. 2. U: Unblock the first simulated process in blocked queue. 3. P: Print the current state of the system. 4. T: Print the average turnaround time, and terminate the system. Command T can only be executed once. 1.1 Simulated Process: Process management simulation manages the execution of simulated processes. Each simulated process is comprised of a program that manipulates the value of a single integer variable. Thus the state of a simulated process at any instant is comprised of the value of its integer variable and the value of its program counter. A simulated process™ program consists of a sequence of instructions. There are seven types of instructions as follows: 1. S n: Set the value of the integer variable to n, where n is an integer. 2. A n: Add n to the value of the integer variable, where n is an integer. 3. D n: Subtract n from the value of the integer variable, where n is an integer. 4. B: Block this simulated process. 5. E: Terminate this simulated process. 6. F n: Create a new simulated process. The new (simulated) process is an exact copy of the parent (simulated) process. The new (simulated) process executes from the instruction immediately after this (F) instruction, while the parent (simulated) process continues its execution n instructions after the next instruction. 7. R filename: Replace the program of the simulated process with the program in the file filename, and set program counter to the first instruction of this new program.
  • 9. An example of a program for a simulated process is as follows: S 1000 A 19 A 20 D 53 A 55 F 1 R file_a F 1 R file_b F 1 R file_c F 1 R file_d F 1 R file_e E You may store the program of a simulated process in an array, with one array entry for each instruction. 2. Process Manager Process:
  • 10. The process manager process simulates four process management functions: creation of new (simulated) processes,replacing the current process image of a simulated process with a new process image,management of process state transitions, andprocess scheduling. In addition, it spawns a reporter process whenever it needs to print out the state of the system. The process manager creates the first simulated process (process id = 0) program from an input file (filename: init). This is the only simulated process created by the process manager on its own. All other simulated processes are created in response to the execution of the F instruction (read from the simulated processes). 2.1 Data structures: The process manager maintains six data structures: Time, Cpu, PcbTable, ReadyState, BlockedState, and RunningState. Time is an integer variable initialized to zero. Cpu is used to simulate the execution of a simulated process that is in running state. It should include data members to store a pointer to the program array, current program counter value, integer value, and time slice of that simulated process. In addition, it should store the number of time units used so far in the current time slice. PcbTable is an array with one entry for every simulated process that hasn't finished its execution yet. Each entry should include data members to store process id, parent process id, a pointer to program counter value (initially 0), integer value, priority, state, start time, and CPU time used so far. ReadyState stores all simulated processes (PcbTable indices) that are ready to run. This can be implemented using a queue or priority queue data structure. BlockedState stores all processes (PcbTable indices) that are currently blocked. This can be implemented using a queue data structure. RunningState stores the PcbTable index of the currently running simulated process. 2.2 Processing input commands: After creating the first process and initializing all its data structures, the process manager repeatedly receives and processes one command at a
  • 11. time from the commander process (read via the pipe). On receiving a Q command, the process manager executes the next instruction of the currently running simulated process, increments program counter value (except for F or R instructions), increments Time, and then performs scheduling. Note that scheduling may involve performing context switching. On receiving a U command, the process manager moves the first simulated process in the blocked queue to the ready state queue array. On receiving a P command, the process manager spawns a new reporter process. On receiving a T command, the process manager first spawns a reporter process and then terminates after termination of the reporter process. The process manager ensures that no more than one reporter process is running at any moment. 2.3 Executing simulated processes: The process manager executes the next instruction of the currently running simulated process on receiving a Qcommand from the commander process. Note that this execution is completely confined to the Cpu data structure, i.e. PcbTable is not accessed. Instructions S, A and D update the integer value stored in Cpu. Instruction B moves the currently running simulated process to the blocked state and moves a process from the ready state to the running state. This will result in a context switch. InstructionEterminates the currently running simulated process, frees up all memory (e.g. program array) associated with that process and updates the PcbTable. A simulated process from the ready state is moved to running state. This also results in a context switch. Instruction F results in the creation of a new simulated process. A new entry is created in the PcbTable for this new simulated process. A new (unique) process id is assigned and the parent process id is process id of the parent simulated process. Start time is set to the current Time value and CPU time used so far is set to 0. The program array and integer value of the new simulated process are a copy of the program array and integer value of the parent simulated process. The new simulated process has the same priority as the parent simulated process. The program counter value of the new simulated process is set to the instruction
  • 12. immediately after the Finstruction, while the program counter value of the of the parent simulated process is set to n instructions after the next instruction (instruction immediately after F). The new simulated process is created in the ready state. Finally, the R instruction results in replacing the process image of the currently running simulated process. Its program array is overwritten by the code in file filename, program counter value is set to 0, and integer value is undefined. Note that all these changes are made only in the Cpu data structure. Process id, parent process id, start time, CPU time used so far, state, and priority remain unchanged. 2.4 Scheduling The process manager also implements a scheduling policy. You may experiment with a scheduling policy of multiple queues with priority classes. In this policy, the first simulated process (created by the process manager) starts with priority 0 (highest priority). There are a maximum of four priority classes. Time slice (quantum size) for priority class 0 is 1 unit of time; time slice for priority class 1 is 2 units of time; time slice for priority class 2 is 4 units of time; and time slice for priority class 3 is 8 units of time. If a running process uses its time slice completely, it is preempted and its priority is lowered. If a running process blocks before its allocated quantum expires, its priority is raised. 3. Reporter Process The reporter process prints the current state of the system on the standard output and then terminates. The output from the reporter process appears as follows: ********************************************************** ****** The current system state is as follows: ********************************************************** ****** CURRENT TIME: time RUNNING PROCESS:
  • 13. pid, ppid, priority, value, start time, CPU time used so far BLOCKED PROCESSES: Queue of blocked processes: pid, ppid, priority, value, start time, CPU time used so far ¦ pid, ppid, priority, value, start time, CPU time used so far PROCESSES READY TO EXECUTE: Queue of processes with priority 0: pid, ppid, value, start time, CPU time used so far pid, ppid, value, start time, CPU time used so far ¦ ¦ Queue of processes with priority 3: pid, ppid, value, start time, CPU time used so far pid, ppid, value, start time, CPU time used so far ********************************************************** ****** Deliverables You will submit to the dropbox, for week 2, three separate files: C or C++ program (source code) Executable file (object), and Instructions to execute the program L A B S T E P S Process Manager (50 points) The program for the process manager functions: process creation, replacing the current process image with a new process image and process state transition, are due this week. This program is to be written in C or C++ programming languages on a Linux environment. IMPORTANT: Please make sure that any question or clarification about these labs are addressed early. 2. Process Manager Process:
  • 14. The process manager process simulates four process management functions: creation of new (simulated) processes,replacing the current process image of a simulated process with a new process image,management of process state transitions, andprocess scheduling. In addition, it spawns a reporter process whenever it needs to print out the state of the system. The process manager creates the first simulated process (process id = 0) program from an input file (filename: init). This is the only simulated process created by the process manager on its own. All other simulated processes are created in response to the execution of the F instruction (read from the simulated processes). 2.1 Data structures: The process manager maintains six data structures: Time, Cpu, PcbTable, ReadyState, BlockedState, and RunningState. Time is an integer variable initialized to zero. Cpu is used to simulate the execution of a simulated process that is in running state. It should include data members to store a pointer to the program array, current program counter value, integer value, and time slice of that simulated process. In addition, it should store the number of time units used so far in the current time slice. PcbTable is an array with one entry for every simulated process that hasn't finished its execution yet. Each entry should include data members to store process id, parent process id, a pointer to program counter value (initially 0), integer value, priority, state, start time, and CPU time used so far. ReadyState stores all simulated processes (PcbTable indices) that are ready to run. This can be implemented using a queue or priority queue data structure. BlockedState stores all processes (PcbTable indices) that are currently blocked. This can be implemented using a queue data structure. RunningState stores the PcbTable index of the currently running simulated process. 2.2 Processing input commands: After creating the first process and initializing all its data structures, the process manager repeatedly receives and processes one command at a
  • 15. time from the commander process (read via the pipe). On receiving a Q command, the process manager executes the next instruction of the currently running simulated process, increments program counter value (except for F or R instructions), increments Time, and then performs scheduling. Note that scheduling may involve performing context switching. On receiving a U command, the process manager moves the first simulated process in the blocked queue to the ready state queue array. On receiving a P command, the process manager spawns a new reporter process. On receiving a T command, the process manager first spawns a reporter process and then terminates after termination of the reporter process. The process manager ensures that no more than one reporter process is running at any moment. 2.3 Executing simulated processes: The process manager executes the next instruction of the currently running simulated process on receiving a Qcommand from the commander process. Note that this execution is completely confined to the Cpu data structure, i.e. PcbTable is not accessed. Instructions S, A and D update the integer value stored in Cpu. Instruction B moves the currently running simulated process to the blocked state and moves a process from the ready state to the running state. This will result in a context switch. InstructionEterminates the currently running simulated process, frees up all memory (e.g. program array) associated with that process and updates the PcbTable. A simulated process from the ready state is moved to running state. This also results in a context switch. Instruction F results in the creation of a new simulated process. A new entry is created in the PcbTable for this new simulated process. A new (unique) process id is assigned and the parent process id is process id of the parent simulated process. Start time is set to the current Time value and CPU time used so far is set to 0. The program array and integer value of the new simulated process are a copy of the program array and integer value of the parent simulated process. The new simulated process has the same priority as the parent simulated process. The program counter value of the new simulated process is set to the instruction
  • 16. immediately after the Finstruction, while the program counter value of the of the parent simulated process is set to n instructions after the next instruction (instruction immediately after F). The new simulated process is created in the ready state. Finally, the R instruction results in replacing the process image of the currently running simulated process. Its program array is overwritten by the code in file filename, program counter value is set to 0, and integer value is undefined. Note that all these changes are made only in the Cpu data structure. Process id, parent process id, start time, CPU time used so far, state, and priority remain unchanged. 1.1 Simulated Process: Additional Information for the Process Manager: Process management simulation manages the execution of simulated processes. Each simulated process is comprised of a program that manipulates the value of a single integer variable. Thus the state of a simulated process at any instant is comprised of the value of its integer variable and the value of its program counter. A simulated process™ program consists of a sequence of instructions. There are seven types of instructions as follows: 1. S n: Set the value of the integer variable to n, where n is an integer. 2. A n: Add n to the value of the integer variable, where n is an integer. 3. D n: Subtract n from the value of the integer variable, where n is an integer. 4. B: Block this simulated process. 5. E: Terminate this simulated process. 6. F n: Create a new simulated process. The new (simulated) process is an exact copy of the parent (simulated) process. The new (simulated) process executes from the instruction immediately after this (F)
  • 17. instruction, while the parent (simulated) process continues its execution n instructions after the next instruction. 7. R filename: Replace the program of the simulated process with the program in the file filename, and set program counter to the first instruction of this new program. An example of a program for a simulated process is as follows: S 1000 A 19 A 20 D 53 A 55 F 1 R file_a F 1 R file_b F 1 R file_c F 1 R file_d F 1
  • 18. R file_e E You may store the program of a simulated process in an array, with one array entry for each instruction. ----------------------------------------------------- ECET 360 Week 4 iLab To Purchase This Material Click below Link For more classes visit www.snaptutorial.com
  • 19. The objective of this week's lab is to simulate and evaluate different memory allocation/deallocation techniques (first fit,next fit, best fit, and worst fit)when a linked list is used to keep track of memory usage.You will implement a separate Memory component for TWO of the four memory allocation/deallocation techniques. This lab is designed to be completed in two weeks. One allocation/deallocation technique is due on Week 4, and the second technique is due on Week 5. Assume that the memory is 256 KB and is divided into units of 2 KB each. A process may request between 3 and 10 units of memory. Your simulation consists of three components: a Memorycomponent that implements a specific allocation/deallocation technique, arequest generation component that generates allocation/deallocation requests, and a statisticsreportingcomponent that prints out the relevant statistics. The Memory component exports the following functions:
  • 20. int allocate_mem(int process_id, int num_units): allocates num_units units of memory to a process whose id is process_id. If successful, it returns the number of nodes traversed in the linked list. Otherwise, it returns -1. int deallocate_mem(int process_id): deallocates the memory allocated to the process whose ID is process_id. It returns 1, if successful, otherwise “1. int fragment_count( ): returns the number of holes (fragments of sizes 1 or 2 units). The request generation component generates allocation and deallocation requests. For allocation requests, the component specifies the process ID of the process for which memory is requested as well as the number of memory units being requested. For this simulation, assume that memory is requested for each process only once. For deallocation requests, the component specifies the process ID of the process whose memory has to be deallocated. For this simulation, assume that the entire memory allocated to a process is deallocated on a deallocation request. You may generate these requests based on some specific criteria, e.g., at random or from a memory allocation/deallocation trace obtained from some source. There are three performance parameters that your simulation should calculate for the chosen two techniques: average number of external fragments, average allocation time in terms of the average number of nodes traversed in allocation, and the percentage of times an allocation request is denied. Generate 10,000 requests using the request generation component, and for each request, invoke the appropriate function of the Memory component for each of the memory allocation/deallocation techniques. After every request, update the three performance parameters for each of the techniques. The statistics reporting component prints the value of the three parameters for the two techniques at the end. You will submit four separate files to the dropbox for Week 4: C or C++ program (source code) Executable file (object) Instructions to execute the program
  • 21. Analysis of the results for the chosen allocation/deallocation technique ----------------------------------------------------- ECET 360 Week 5 Lab Memory Management II To Purchase This Material Click below Link For more classes visit www.snaptutorial.com Objective
  • 22. To write a C program to implement memory management using segmentation. ALGORITHM: Step1 : Start the program. Step2 : Read the base address, number of segments, size of each segment, memory limit. Step3 : If memory address is less than the base address display “invalid memory limit”. Step4 : Create the segment table with the segment number and segment address and display it. Step5 : Read the segment number and displacement. Step6 : If the segment number and displacement is valid compute the real address and display the same. Step7 : Stop the program ----------------------------------------------------- ECET 360 Week 6 and 7 Lab To Purchase This Material Click below Link For more classes visit www.snaptutorial.com
  • 23. Write a C program to simulate the shortest job first algorithm with preemption. DESCRIPTION: For implementing SJF algorithm with preemption, we consider the arrival times of each process, the burst times of all the previously arrived processes. After the arrival of all the processes into the ready queue, the average waiting time and turn around time can be calculated by using the above algorithm. -----------------------------------------------------