State the methods of task synchronization. Describe semaphore with suitable example.

1 Answer

Answer :

The methods of task synchronization are:  Semaphore  Message queue.  Mutual exclusion.  Dead lock.  Mailboxes.  Message Queues.

Semaphores:  It is a system of sending message by using flags. Multiple concurrent threads of execution with an application must be able to synchronize their execution & co-ordinate mutually exclusive access to shared resources.  To fulfill this requirement RTOS kernel provides a semaphore object that one or more threads of execution can acquire or release for the purpose of synchronization or mutual exclusion. Semaphore is like a key that allows a test to carry out some operation or to access a resource. When task acquires the semaphore, it receives an access to the resource.  The number of times the semaphore can be acquired by the task is determined by the resource count of a semaphore.  A resource count is decremented by one, when a task acquires the semaphore and its resource count is incremented by one when a task releases the semaphore.  A kernel supports many different types of semaphores :

Binary: Binary semaphores are used for both mutual exclusion and synchronization purposes. A binary semaphore is used to control sharing a single resource between tasks.. 

Counting: it is a semaphore that increments when an IPC is given by a task. It decrements when a waiting task unblocks and starts running. 

Mutex or Mutually Exclusion semaphore: In this a mutex key is used to lock the shared resource, if it is acquired by the task, so that any other task cannot acquire until it is released.

Example of using semaphores for Synchronization: Assume two concurrent process P1 and P2 having statements S1 and S2. We want in any case S1 should execute first. this can be achieved easily by initialize Sem=0; 

In process P1 



// Execute whatever you want to do 

// before executing P2 

S1; 

signal(Sem); 



in process P2 



wait(Sem); 

S2; 

}

Related questions

Description : What is a semaphore? 

Last Answer : A resource management, synchronization, and locking tool. 

Description : There are three processes P1, P2 and P3 sharing a semaphore for synchronising a variable. Initial value of semaphore is one. Assume that negative value of semaphore tells us how many processes are waiting in queue. Processes access ... The final value of semaphore will be: (1) 0 (2) 1 (3) -1 (4) -2 

Last Answer : Answer: 1

Last Answer : A semaphore is called binary semaphore when its value is 0, it is assumed that it has been taken (or accepted) & when its value is 1, it is assumed that it has been released & no ... that are not themselves reentrant.3. A reentrant function may does not use the hardware in a nonatomic way.

Description : What are counting semaphores and resource semaphore?

Last Answer : If a task tries to take the semaphore when the integer is equal to zero, then the task will block. These semaphores are called counting semaphore. Some system offer semaphore that can be ... , but they cannot be used to communicate between two tasks. Such semaphores are called resource semaphore.

Description : Draw the block diagram of an embedded system and describe the hardware units of an embedded system.

Last Answer : OR Explanation: The embedded system consist of different components embedded into it as follows: 1) Embedded Processor 2) Power supply , reset and Oscillator circuits 3) System timers 4) ... to store data and program. Following are types of memories used in embedded system.

Description : What is multicore processor? Describe in brief.

Last Answer : Multicore Processor: It is an integrated circuit in which two or more processors core have been packaged for enhanced performance, reduced power consumption and more efficient simultaneous ... Multicore processors will give the benefits to all software especially for multithreaded program.

Description : Distributed under Creative Commons Attribution-ShareAlike - CC BY-SA. 

Last Answer : Many embedded systems must continually react to changes in the system's environment and must compute certain results in real time without delay. For example, a car's cruise controller continually monitors and ... user, typically does not result in a system failure.  Version 2 EE IIT, Kharagpur

Description : Define “Drug Adulteration”. Describe any four methods of adulteration with suitable examples.

Last Answer : Definition: Adulteration is the debasement of an article. Methods of Adulteration : 1. Replacement by exhausted drugs Ex. a).Exhausted saffron is coloured artificially  b)Exhausted Ginger is mixed with starch ... .  c) White oil in oil of Coconut.  d) Stearin or paraffin in cocoa butter.

Description : List three methods of fuel injection. Describe sequential method with suitable sketch.

Last Answer : Methods of petrol injection 1. Sequential fuel injection. (SFI) 2. Grouped fuel injection. 3. Simultaneous fuel injection 4. Continuous injection.  Sequential Injection: Each injector ... to crank/ camshaft position and pulse width, can be optimized for each individual cylinder.

Description : What are the different methods of contouring? Describe any one method along with sketch . Also write the situation where it is suitable

Last Answer : There are two methods of contouring:- 1. Direct Method 2. Indirect Method - a. By squares  b. By cross section  c. By tacheometric Direct method of contouring - In this ... joining these identical coloured pegs, we get the required contours on ground by this direct method of contouring. 

Description : Explain the term ‘Deadlock’. State reason of occurance.

Last Answer : A deadlock is a situation where in two or more competing actions are each waiting for the other to finish, and thus neither ever does.  * Assume thread/process T1 has exclusive access to resource R1. ... P1 to Pn P1 waiting for the resource held by P2, P2 waiting for resource held by P3 etc.

Description : State two examples of RTOS.

Last Answer : 1. LynxOS. 2. OSE. 3. QNX. 4. RTLinux. 5. VxWorks. 6. Windows CE.

Description : State the use of MAX 232 in communication.

Last Answer : MAX 232 is line driver that converts from RS232 voltage levels to TTL voltage levels & vice versa in serial communication 

Description : State four advantages of embedded system. 

Last Answer : 1) Design and Efficiency 2) Cost 3) Accessibility 4) Maintenance 5) Redundancies

Description : State four features of Zigbee.

Last Answer : Zigbee features (any4):- IEEE Standard 802.15.4 Frequency (GHz) 0.868, 0.915, 2.4 Maximum bit rate (Mbps) 0.250 or 250 Kbps, low bit rate Typical data throughput (Mbps) 0.2 ... Range (Meters) 10-100 Relative Power Consumption Very low Battery Life Months to years Network Size 64,000+ 

Description : State any four features of IDE.

Last Answer : Features of IDE 1) IDE normally consists of source code editor, a compiler, build automation tools and debugger. 2) It supports for defining a processor family and its version. 3) ... 4) Provides multiuser environment. 5) Supports conditional and unconditional break points. 6) Provides debugger.

Description : Which of the following is a repeatable task within a business process? a) service b) bus c) methods d) all of the mentioned

Last Answer : service

Description : Which of the following is a repeatable task within a business process? a) service b) bus c) methods d) all of the mentioned

Last Answer : service

Description : Better classroom management means (a) per group work and better interaction among pupils (b) prior preparation of teacher in the making of suitable aids (c) Punctuality of the teachers in coming in the ... creating problems (f) Avoid teaching when pupils are not in proper mood (g) All of these

Last Answer : (g) All of these

Description : You have to sort a list L, consisting of a sorted list followed by a few ‘random’ elements. Which of the following sorting method would be most suitable for such a task ? (A) Bubble sort (B) Selection sort (C) Quick sort (D) Insertion sort

Last Answer : (D) Insertion sort

Description : Explain the need to consider following factors in design matrix of embedded system: (i) Processor (ii) Memory (iii) Power (iv) Non- recurring engineering cost.

Last Answer : 1. Processor: Selection of processor depends upon amount of processing power and the register width required. Powerful 8bit, 16 bit, 32 bit & 64bit processors are available. The clock speed ... system is designed any number of units can be manufactured without incurring any additional design cost.

Description : Compare synchronous and asynchronous communication.

Last Answer : Synchronous communication Asynchronous communication Single clock is used for both transmitter and receiver Two different clocks are used for both transmitter and receiver Data bits are transmitted ... Character is received at a any rate Less reliable More reliable

Description : Write a C language program to operate port 0 and port 2 as output port and port 1 and port 3 as input port.

Last Answer : #include void main (void ) { unsigned char X,Y P0=0X00; // P0 as output port P2=0X00;// P2 as output port P1=0XFF;//P1 as input port P3=0XFF;// P3 as input port while(1) { X= P1; Y=P3; P0=X; P2=Y; }//end of while }//end of main

Description : Compare features of PIC and AVR microcontrollers

Last Answer : Parameters PIC AVR Bus width 8/16/32-bit 8/32-bit Communication Protocols UART, USART, LIN, CAN, Ethernet, SPI, I2C UART, USART, SPI, I2C, (special ... Average Atmel Popular Microcontrollers PIC18fXX8, PIC16f88X, PIC32MXX Atmega8, 16, 32, Arduino Community

Description : Sketch pin-out diagram of LM35 and label its pin.

Last Answer :  pin-out diagram of LM35 and label its pin

Description : Develop a ‘C’ program to transfer the data from port P0 to port P1.

Last Answer : #include void main (void ) { unsigned char X; P0=0XFF; // P0 as input port P1=0X00;//P1 as output port while(1) //do forever { X = P0;//read port0 P1 = X;// output data to port1 }

Description : List out four types of embedded systems.

Last Answer : 1. Small Scale Embedded Systems 2. Medium Scale Embedded Systems 3. Sophisticated Embedded Systems 4. Stand Alone Embedded Systems 5. Real Time Embedded Systems 6. Networked Embedded Systems 7. Mobile Embedded Systems

Description : Draw the labeled interfacing diagram to interface relay with 89C51 microcontroller.

Last Answer : the labeled interfacing diagram to interface relay with 89C51 microcontroller

Description : Distributed under Creative Commons Attribution-ShareAlike - CC BY-SA.

Last Answer : The time required to develop a system to the point that it can be released and sold to customers. The main contributors are design time, manufacturing time, and testing time. This metric has become ... early can make a big difference in the system's profitability. Version 2 EE IIT, Kharagpur

Description : Distributed under Creative Commons Attribution-ShareAlike - CC BY-SA.

Last Answer : Hard drives have two kinds of components: internal and external. External components are located on a printed circuit board called logic board while internal components are located in a sealed chamber called HDA or Hard ... that a Hard Disk Drive is an RTES.  Version 2 EE IIT, Kharagpur 

Description : Distributed under Creative Commons Attribution-ShareAlike - CC BY-SA.

Last Answer : The Performance Design Metric Performance of a system is a measure of how long the system takes to execute our desired tasks. The two main measures of performance are:  Latency or ... the available processors rather than going for a custom design.  Version 2 EE IIT, Kharagpur 

Description : Distributed under Creative Commons Attribution-ShareAlike - CC BY-SA.

Last Answer : Design Metrics  A Design Metric is a measurable feature of the system's performance, cost, time for implementation and safety etc. Most of these are conflicting requirements i.e. optimizing one ... test circuitry to check that manufacturing was correct.  Version 2 EE IIT, Kharagpur

Description : Distributed under Creative Commons Attribution-ShareAlike - CC BY-SA.

Last Answer : Components of an Embedded System   By this time we know where are our Embedded Systems and what makes them stand out from other systems like Calculators, Desktop Computers, and our Old Television ... account the technical as well as economic considerations.  Version 2 EE IIT, Kharagpur

Description : Distributed under Creative Commons Attribution-ShareAlike - CC BY-SA.

Last Answer : Structure and Design Instructional Objectives  After going through this lesson the student will  Learn more about the numerous day-to-day real time embedded systems  Learn the ... data such as phone numbers, calendars information, games etc.  Version 2 EE IIT, Kharagpur

Description : Distributed under Creative Commons Attribution-ShareAlike - CC BY-SA. 

Last Answer : Manufacturer  Model:  Network Types:  EGSM/ GSM /CDMA  Form Factor: The industry standard that defines the physical, external dimensions of a particular device. The size, configuration, and other specifications used ...   Speaker  Phone:  USB:  Vibrate: Version 2 EE IIT, Kharagpur

Description : Distributed under Creative Commons Attribution-ShareAlike - CC BY-SA. 

Last Answer : Five advantages:  1. Smaller Size  2. Smaller Weight  3. Lower Power Consumption  4. Lower Electromagnetic Interference  5. Lower Price  Five disadvantages  1. Lower Mean Time Between Failure  ... Obsolesce  4. Unmanageable Heat Loss  5. Difficult to Design  Version 2 EE IIT, Kharagpur

Description : Which of the following is a real time embedded system? Justify your answer (a) Ceiling Fan (b) Microwave Oven (c) Television Set (d) Desktop Key Board (e) Digital Camera Distributed under Creative Commons Attribution-ShareAlike - CC BY-SA. 

Last Answer : (b) and (e) are embedded systems  (a) Ceiling Fans: These are not programmable.  (b) & (e) obey all definitions of Embedded Systems such as (i) Working in Real Time (ii) Programmable ... mass-produced, so the cost savings may be multiplied by millions of items.  Version 2 EE IIT, Kharagpur

Description : Distributed under Creative Commons Attribution-ShareAlike - CC BY-SA.

Last Answer : Common Architecture of Real Time Embedded Systems  Unlike general purpose computers a generic architecture can not be defined for a Real Time Embedded Systems. There are as many architecture as the ... monitored through an ADC interfaced through this CODEC. Version 2 EE IIT, Kharagpur

Description : Distributed under Creative Commons Attribution-ShareAlike - CC BY-SA.

Last Answer : Definitions  Now we are ready to take some definitions  Real Time  Real'-time usually means time as prescribed by external sources For example the time struck by clock (however ... the computer user, typically does not result in a system failure.   Version 2 EE IIT, Kharagpur

Description : Distributed under Creative Commons Attribution-ShareAlike - CC BY-SA.

Last Answer : Lesson 1 Introduction to Real Time Embedded Systems Part I  Example, Definitions, Common Architecture  Instructional Objectives After going through this lesson the student would be able to  Know what an ... as a Real Time Embedded System (RTES)  Version 2 EE IIT, Kharagpur

Description : How to increase brain-hand synchronization for games?

Last Answer : Practice. Lots and lots of practice. Don’t beat yourself up if you fail, just keep practicing. It will come eventually.

Description : What is a good free bookmark synchronization service?

Last Answer : Weave is good for just Firefox; it does more than just sync the bookmarks. I don’t believe it supports other browser yet.

Description : The Event Horizon Telescope required multiple telescopes, with split-second synchronization, to capture the image of the M87 black hole. How many telescopes were used? -Space

Last Answer : Recognizing their vision and leadership within the Event Horizon Telescope (EHT), the National Academy of Sciences (NAS) awards Shep Doeleman and Heino Falcke the Henry Draper Medal. ... a recent, original investigation in astronomical physics of sufficient importance and benefit to science.

Description : What is Bit Synchronization ?

Last Answer : The method used to coordinate between different bits when sending a signal is called bit synchronization.

Description : While starting a main propulsion synchronous motor, the ammeter pegs out at maximum and then returns to the proper value after synchronization. This indicates the _____________. A. motor has started ... field windings are grounded C. slip rings are dirty D. power transmission cables are grounded

Last Answer : Answer: A

Description : On a vessel with turbo-electric drive, which of the following conditions would indicate that the propulsion motor had dropped out of synchronization with the propulsion generator? A. Excessive ... Tripped main motor interlocks C. Overheated crosstie busses D. Closed contact in the field circuits

Last Answer : Answer: A

Description : Which causes a quantization noise in PCM system? A. Serial transmission errors B. The approximation of the quantized signal C. The synchronization between encoder and decoder D. Binary coding techniques

Last Answer : B. The approximation of the quantized signal

Description : Which causes a quantization noise in PCM system? A. Serial transmission errors B. The approximation of the quantized signal C. The synchronization between encoder and decoder D. Binary coding techniques

Last Answer : The approximation of the quantized signal

Description : What synchronization is provided so that the start and end of message is identified? A. Carrier B. Character C. Bit D. Clock

Last Answer : B. Character

Description : What is known as the alignment of the three color guns to a common point? A. Confetti B. Divergence C. Convergence D. Synchronization

Last Answer : C. Convergence