Friday 23 October 2020

PRACTICE PROBLEMS BASED ON BANKER’S ALGORITHM

 

Problem-01:


Considering a system with four processes P0 through P3 and three resources of type A, B, C. Resource type A has 10 instances, B has 5 instances and type C has 7 instances. Suppose at time t0 following snapshot of the system has been taken:





Question1. What will be the content of the Need matrix?

Question2.  Is the system in a safe state? If Yes, then what is the safe sequence?

Problem-02:


Question1. What will be the content of the Need matrix?

Question2.  Is the system in a safe state? If Yes, then what is the safe sequence?

Question3. What will happen if process Prequests one additional instance of resource type A and two instances of resource type C?


Problem-03:

 

A single processor system has three resource types X, Y and Z, which are shared by three processes. There are 5 units of each resource type. Consider the following scenario, where the column alloc denotes the number of units of each resource type allocated to each process, and the column request denotes the number of units of each resource type requested by a process in order to complete execution. Which of these processes will finish LAST?

  1. P0
  2. P1
  3. P2
  4. None of the above since the system is in a deadlock



Problem-04:

 

An operating system uses the banker’s algorithm for deadlock avoidance when managing the allocation of three resource types X, Y and Z to three processes P0, P1 and P2. The table given below presents the current system state. Here, the Allocation matrix shows the current number of resources of each type allocated to each process and the Max matrix shows the maximum number of resources of each type required by each process during its execution.

AllocationMax
XYZXYZ
P0001843
P1320620
P2211333

 

There are 3 units of type X, 2 units of type Y and 2 units of type Z still available. The system is currently in safe state. Consider the following independent requests for additional resources in the current state-

 

REQ1: P0 requests 0 units of X, 0 units of Y and 2 units of Z

REQ2: P1 requests 2 units of X, 0 units of Y and 0 units of Z

 

Which of the following is TRUE?

  1. Only REQ1 can be permitted
  2. Only REQ2 can be permitted
  3. Both REQ1 and REQ2 can be permitted
  4. Neither REQ1 nor REQ2 can be permitted


Problem-05:

 

A system has 4 processes and 5 allocatable resource. The current allocation and maximum needs are as follows-

AllocatedMaximum
A1021111213
B2011022210
C1101121311
D1111011220

 

If Available = [ 0 0 X 1 1 ], what is the smallest value of x for which this is a safe state?


Problem-06:

An operating system uses the Banker’s algorithm for deadlock avoidance when managing the allocation of three resource types X, Y, and Z to three processes P0, P1, and P2. The table given below presents the current system state. Here, the Allocation matrix shows the current number of resources of each type allocated to each process and the Max matrix shows the maximum number of resources of each type required by each process during its execution.

GATECS2014Q42

There are 3 units of type X, 2 units of type Y and 2 units of type Z still available. The system is
currently in a safe state. Consider the following independent requests for additional resources in the
current state:

REQ1: P0 requests 0 units of X,  
      0 units of Y and 2 units of Z
REQ2: P1 requests 2 units of X, 
      0 units of Y and 0 units of Z

Which one of the following is TRUE?
(A) Only REQ1 can be permitted.
(B) Only REQ2 can be permitted.
(C) Both REQ1 and REQ2 can be permitted.
(D) Neither REQ1 nor REQ2 can be permitted


Problem-07:


 A system has 12 magnetic tape drives and 3 processes : P0, P1, and P2. Process P0 requires 10 tape drives, P1 requires 4 and P2 requires 9 tape drives.

Process    
P0            
P1                             
P2                             
 
Maximum needs (process-wise: P0 through P2 top to bottom)    
10             
4   
9
 
Currently allocated (process-wise)
5
2
2

Which of the following sequence is a safe sequence?
a) P0, P1, P2
b) P1, P2, P0
c) P2, P0, P1
d) P1, P0, P2

Thursday 22 October 2020

Minimum number of resource for deadlock free system

 



Consider there are n processes in the system P1, P2, P3, …… , Pn where-


Process P1 requires x1 units of resource R

Process P2 requires x2 units of resource R

Process P3 requires x3 units of resource R and so on.


In worst case,


The number of units that each process holds = One less than its maximum demand

 


So,


Process P1 holds x1 – 1 units of resource R

Process P2 holds x2 – 1 units of resource R

Process P3 holds x3 – 1 units of resource R and so on.

 


Now,


Had there been one more unit of resource R in the system, system could be ensured deadlock free.

This is because that unit would be allocated to one of the processes and it would get execute and then release its units.


So, Maximum number of units of resource R that ensures deadlock


= (x1-1) + (x2-1) + (x3-1) + …. + (xn-1)


= ( x1 + x2 + x3 + …. + xn ) – n


= ∑xi – n


= Sum of max needs of all n processes – n


Minimum Number Of Units That Ensures No Deadlock-

 


Minimum number of units of resource R that ensures no deadlock


= One more than maximum number of units of resource R that ensures deadlock


= (∑xi – n) + 1



or 

R > = P * ( N - 1 ) + 1


Where R is the minimum number of resources

P is the number of processes

N Max need for each process


Deadlock Practice Questions:

 

1 - A system is having 3 user processes each requiring 2 units of resource R. The minimum number of units of R such that no deadlock will occur-

  1. 3
  2. 5
  3. 4
  4. 6

2 - A system is having 10 user processes each requiring 3 units of resource R. The minimum number of units of R such that no deadlock will occur _____?


3 - A system is having 3 user processes P1, P2 and P3 where P1 requires 2 units of resource R, P2 requires 3 units of resource R, P3 requires 4 units of resource R. The minimum number of units of R that ensures no deadlock is _____?


4 - A system is having 3 user processes P1, P2 and P3 where P1 requires 21 units of resource R, P2 requires 31 units of resource R, P3 requires 41 units of resource R. The minimum number of units of R that ensures no deadlock is _____?


5 - If there are 6 units of resource R in the system and each process in the system requires 2 units of resource R, then how many processes can be present at maximum so that no deadlock will occur?


6 - If there are 6 units of resource R in the system and each process in the system requires 3 units of resource R, then how many processes can be present at maximum so that no deadlock will occur?


7 - If there are 100 units of resource R in the system and each process in the system requires 2 units of resource R, then how many processes can be present at maximum so that no deadlock will occur?


8 - If there are 100 units of resource R in the system and each process in the system requires 4 units of resource R, then how many processes can be present at maximum so that no deadlock will occur?


9 - If there are 100 units of resource R in the system and each process in the system requires 5 units of resource R, then how many processes can be present at maximum so that no deadlock will occur?


10 - A computer system has 6 tape drives with n processes competing for them. Each process needs 3 tape drives. The maximum value of n for which the system is guaranteed to be deadlock free-


11 - Consider a system having m resources of the same type. These resources are shared by 3 processes A, B and C which have peak demands of 3, 4 and 6 respectively. For what value of m, deadlock will not occur?

  1. 7
  2. 9
  3. 10
  4. 13

12 - Consider a system having m resources of the same type being shared by n processes. Resources can be requested and released by processes only one at a time. The system is deadlock free if and only if-

  1. The sum of all max needs is < m+n
  2. The sum of all max needs is > m+n
  3. Both of above
  4. None of these






Ans

  1. 4
  2. 21
  3. 7
  4. 91
  5. 5
  6. 2
  7. 99
  8. 33
  9. 24
  10. 2
  11. 13
  12. The sum of all max needs is < m+n


Deadlock Handling Strategies

 


The various strategies for handling deadlock are-


  • Deadlock Prevention
  • Deadlock Avoidance
  • Deadlock Detection and Recovery
  • Deadlock Ignorance

Deadlock Prevention

It ensure that the four condition for deadlock do not occur simultaneously.

Deadlock Avoidance-

  • It analyses the allocation state to determine whether granting a request of resource might to deadlock later.
  • Banker’s Algorithm is an example of a deadlock avoidance strategy.
  • RAG (Resource Allocation Graph) is also is an example of a deadlock avoidance strategy.

Deadlock Detection and Recovery-

  • This strategy involves waiting until a deadlock occurs.
  • After deadlock occurs, the system state is recovered.
  • The main challenge with this approach is detecting the deadlock.

Deadlock Ignorance-

  • This strategy involves ignoring the concept of deadlock and assuming as if it does not exist.
  • This strategy helps to avoid the extra overhead of handling deadlock.
  • Windows and Linux use this strategy and it is the most widely used method.
  • It is also called as Ostrich approach.

Deadlock in OS | Conditions for Deadlock

 


Deadlock in OS-

Two or more processes are said to be in deadlock if they are waiting for the happing of an event, which would never happen.

The execution of two or more processes is blocked because each process holds some resource and waits for another resource held by some other process.

Example-



Here


  • Process P1 holds resource R1 and waits for resource R2 which is held by process P2.
  • Process P2 holds resource R2 and waits for resource R1 which is held by process P1.
  • None of the two processes can complete and release their resource.
  • Thus, both the processes keep waiting infinitely.

Conditions For Deadlock-

There are following 4 necessary conditions for the occurrence of deadlock-

  • Mutual Exclusion
  • Hold and Wait
  • No - Preemption
  • Circular Wait

1. Mutual Exclusion-


  • There must exist at least one resource in the system which can be used by only one process at a time.
  • If there exists no such resource, then deadlock will never occur.
  • Printer is an example of a resource that can be used by only one process at a time


2. Hold and Wait-
 

There must exist a process which holds some resource and waits for another resource held by some other process.

3. No Preemption-
 

  • Once the resource has been allocated to the process, it can not be preempted.
  • It means resource can not be snatched forcefully from one process and given to the other process.
  • The process must release the resource voluntarily by itself.


4. Circular Wait-
 
All the processes must wait for the resource in a cyclic manner where the last process waits for the resource held by the first process.





Here,

  • Process P1 waits for a resource held by process P2.
  • Process P2 waits for a resource held by process P3.
  • Process P3 waits for a resource held by process P4.
  • Process P4 waits for a resource held by process P1.
 

Important Note-

 
  • All these 4 conditions must hold simultaneously for the occurrence of deadlock.
  • If any of these conditions fail, then the system can be ensured deadlock free.

Wednesday 21 October 2020

Operating System Semaphore MCQ Questions

 


1. An un-interruptible unit is known as ____________

a) single

b) atomic

c) static

d) none of the mentioned


2. Semaphore is a/an _______ to solve the critical section problem.

a) hardware for a system

b) special program for a system

c) integer variable

d) none of the mentioned



3. If the semaphore value is negative ____________

a) its magnitude is the number of processes waiting on that semaphore

b) it is invalid

c) no operation can be further performed on it until the signal operation is performed on it

d) none of the mentioned



4. The code that changes the value of the semaphore is ____________

a) remainder section code

b) non – critical section code

c) critical section code

d) none of the mentioned


5. The following program consists of 3 concurrent processes and 3 binary semaphores. The semaphores are initialized as S0 = 1, S1 = 0, S2 = 0.



How many times will process P0 print ‘0’?

(A) At least twice

(B) Exactly twice

(C) Exactly thrice

(D) Exactly once






Tuesday 13 October 2020

Language Across Curriculum

 

1. What is the main language skill?


A - Writing, Listing

B - Reading

C - To Speak

D - All of The Above



2. What are the main Elements of language?


A - Sound

B - The Signal

C - Symbol

D - All of The Above



3. Should there be a medium to teach language teaching to a child?


A - National Language

B - Mother Language

C - Second Language

D - Regional Language


4. Meaning of Mother Tongue?


A - Family Language

B - Mother Language

C - Father Language

D - All of The Above


5 - The main purpose of mother tongue is?


A - Mental Growth

B - Physical Development

C - Intellectual Development

D - All of The Above



Thursday 8 October 2020

Lesson plan, Mid-Day Meal, Teaching Aids

 


Lesson plan

A lesson plan is a document that outlines the content of your lesson step-by-step. A lesson plan is usually prepared in advance and can either cover a one-off activity, an entire lesson, a unit or course, a day, or a week

Some sections you might want to include in your lesson plan are:

Lesson activities

Lesson materials

Lesson objectives

Lesson goals

Lesson feedback



Mid-day Meal Scheme

Launched in 1995


Teaching Aids

Teaching aids (TAs): Teaching aids are objects (such as a book, picture, or map) or devices (such as a DVD or computer) used by a teacher to enhance or enliven classroom instruction They could be audiovisual teaching aids such as videos and guest lectures or tactile like 3D models.

Teaching Methodology Concepts




Teaching Methodology Concepts



What is CCE?

Continuous and Comprehensive Evaluation was a process of assessment, mandated by the Right to Education Act, of India in 2009.


Continuous and comprehensive evaluation refers to a student assessment system which covers all facets of education. According to a CBSE Concept Note on Conceptual Framework of CCE, “it is a developmental process of assessment which emphasises on (sic) two fold objectives: continuity in evaluation and assessment of broad based learning and behavioural outcomes”.

Assessment processes.

The CCE process is made up of formative and summative assessment components.




Differences between formative and summative assessments


The evaluation takes place during the learning process.
Not during the process, but after it.


monitoring the learning process.
assign grades. achieved the learning goal or not.


improve student’s learning.
evaluate student’s achievements.



little content areas.
complete chapters or content areas.


Evaluation as a process. the teacher can see a student grow and steer the student in an upwards direction.

summative assessments or evaluations are considered to be more of a “product”.


Scholastic and co-scholastic Activities


The difference between scholastic and co-scholastic areas of assessment is below:


(i) Scholastic Areas of Assessment: These areas focus on oral and written class tests, cycle tests, activity tests and daily class performances of all subjects in order to improve writing and speaking skills.


(ii) Co-Scholastic Areas of Assessment: These areas focus on enhancing the skills of a student in general knowledge, environmental education, physical Education, art, music and dance and computers. These are assessed through quizzes, competitions and activities.


 
How many chapters does NCF 2005 have?


NCF 2005 is a document consisting of five chapters.

Who made NCF 2005?

The National Curriculum Framework is one of four National Curriculum Frameworks published in 1975, 1988, 2000 and 2005 by the National Council of Educational Research and Training NCERT in India.

NCF Years

1975
1988
2000
2005

Learning without Burden include in which NCF?

NCF 2005


Micro Teaching

Micro-teaching is a teacher training and faculty development technique.
Microteaching is a technique aiming to prepare teacher candidates to the real classroom setting
One teacher teach and other teacher observe

Skill of Micro Teaching

Skill of Introducing, Skill of Questioning, Skill of Explaining, Skill of Black-board Writing, and Skill of Achieving Closure.


Micro Teaching Time : (5-10 Mins)
Micro Teaching Students: (10-15)
Short Topic

Reinforcement

Reinforcement can be used to teach new skills, teach a replacement behavior for an interfering behavior, increase appropriate behaviors, or increase on-task behavior.
Reinforcement is used to promote learning and to draw the attention of the students. It also provides a greater motivation to the students.
There are two types of reinforcement, known as positive reinforcement and negative reinforcement; 

What is scaffolding in teaching?

Scaffolding refers to a variety of instructional techniques used to move students progressively toward stronger understanding and, ultimately, greater independence in the learning process.

Scaffolding helps students to become independent and self-regulating learners and problem solvers

Give mini-lessons.
Model/demonstrate.
Describe concepts in multiple ways.
Incorporate visual aids.
Give students talk time.
During lessons, check for understanding.
Activate prior knowledge.
Front-load concept-specific vocabulary.


National Policy on Education Years
1968
1986
1992
2020

The main objective of NCF 2005 are as follows:

Education of girl child.
Early childhood education.
Implementation of the national curriculum framework.
Vocational education.
Improvement in teacher education.
Improvement of thought of students.
Competitive value of education.


Quality of good teacher:

Strong Communicators
Listen Well
Focus on Collaboration
Adaptable
Engaging
Show Empathy
Have Patience
Real-World Learning
Share Best Practices
Lifelong Learners
Effective Teaching


RTE
Right to Education Act

1. Compulsory and free education for all
2. The benchmark mandate
3. Special provisions for special cases
4. Quantity and quality of teachers
5. Zero tolerance against discrimination and harassment
6. Ensuring all round development of children
7. Improving learning outcomes to minimise detention
8. Monitoring compliance of RTE norms
9.Creating inclusive spaces for all





Wednesday 7 October 2020

Operating System MCQ

 


Which of the following is not an operating system?

  1. Windows
  2. Linux
  3. Oracle
  4. DOS

What is the maximum length of the filename in DOS?

  1. 4
  2. 5
  3. 8
  4. 12

When was the first operating system developed?

  1. 1948
  2. 1949
  3. 1950
  4. 1951

When were MS windows operating systems proposed?

  1. 1994
  2. 1990
  3. 1992
  4. 1985

What else is a command interpreter called?

  1. prompt
  2. kernel
  3. shell
  4. command

What is the full name of FAT?

  1. File attribute table
  2. File allocation table
  3. Font attribute table
  4. Format allocation table

BIOS is used?

  1. By operating system
  2. By compiler
  3. By interpreter
  4. By application software

What is the mean of the Booting in the operating system?

  1. Restarting computer
  2. Install the program
  3. To scan
  4. To turn off

Which is the Linux operating system?

  1. Private operating system
  2. Windows operating system
  3. Open-source operating system
  4. None of these

What is the full name of the DSM?

  1. Direct system module
  2. Direct system memory
  3. Demoralized system memory
  4. Distributed shared memory