Please Log in or Register for more.


382 views

1 Answer

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 task has taken it yet.
An ISR can release the token. A task can release the token as well accept the token or wait for taking the token.

Shared data problem solutions:

One solution is atomic queue operation for solving the shared data problem.
1.Use modifier volatile with a declaration for a variable that returns from the interrupt. This declaration warns the compiler that certain variables can modify because the ISR does not consider the fact that the variable is also shared with a calling function.
2.Use reentrant functions with atomic function instructions in that part of a junction that needs its complete execution before it can be interrupted.
3.Put a shared in a critical queue. A function that requires the value of this variable always deletes it from the queue front, and another function, which inserts the value of this variable. always does so at the queue back.
4.Disable the interrupts before a critical section starts executing & enable the interrupts on its completion it is a powerful drastic option. An interrupt even is of higher priority than the present critical function gets disabled.

Shared-Data Problems
Void Task1 (void)
{
:
vconterErrors(9);
:
}
void Task2 (void)
{
:
vcontErrors(11);
:
}
static int cErrors;

void vconutErrors (int vNewErrors)
{
cErrors += cNewErrors:
}

Fig. Tasks can share code

The above fig shows a bug in the code. Here both task1 and task2 call vcontErrors. This is a perfectly valid thing to do in an RTOS. Any or all of the tasks can share as many subroutines as is convenient.
The difficulty with the program is that because both Task1 and Task2 call vcontErrors and since vcontErrors uses the variable cErrors is now shared by the 2 tasks.
If task1 calls vcontErrors, and if the RTOS then stops Task1 and runs Task2 which then calls vcontErrors, the variable cErrors may get corrupted in just the same way as it would if Task2 were an interrupt routine that had interrupted Task1.

Reentrancy:
Reentrant functions are functions that can be called by more than one task and that will always work correctly, even if the RTOS switches from one task to another in the middle of executing the function.
The 3 rules to decide if a function is reentrant are:
1. A reentrant function may not use variables in a nonatomic way unless they are stored on the stack of the task that called the function or are otherwise the private variables of that task that called the function or are otherwise the private variables of that task.
2. A reentrant function may not call any other functions that are not themselves reentrant.
3. A reentrant function may does not use the hardware in a nonatomic way.

Like 0 like

Please log in or register to answer this question.

Related Questions


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.

Show More

750 views 1 answer








Last Answer : Common computation models: Sequential program model Statements, rules for composing statements, semantics for executing them Communicating process model ... Object-oriented model For breaking complex software into simpler, well-defined pieces

Show More

107 views 1 answer








Last Answer : Various features of Linux that are used in embedded systems are as follows : Linux is multiuser operating system. Linux is open source and free. Linux can be ... Linux supports handling of errors. Real-time Linux supports the group scheduling functions.

Show More

138 views 1 answer








Last Answer : Liquid Crystal Display:-An LCD is a low-cost, low power device capable of displaying text and images. LCD's are extremely common in embedded systems since such system often does not have video monitors ... toggles the enables bit and acts as a delay so that the command can be processed and executed.

Show More

183 views 1 answer








Last Answer : The main characteristics of an embedded system are:1. Single functioned2. Tightly constrained3. Reactive and real time1. Single functioned:An embedded system usually executes a specific program repeatedly.Ex. Pager ... computer user. But it doesn't result in a system failure.Ex. Digital camera chip

Show More

348 views 1 answer







Define embedded system.
Last Answer : An embedded system is nearly any computing system other than a desktop computer. Embedded systems are hard to define because they cover such a broad range of electronic devices. It has three main components: 1. Hardware 2. Main application software 3. Real time operating system

Show More

123 views 1 answer








Last Answer : Shared memory :For sharing of data faster and communication between programs, we use shared memory. Shared memory can be used with multiprocessors and single processors. Means Program ... No resource preemption4. Circular waitIf the four conditions occur simultaneously then the deadlock occurs.

Show More

665 views 1 answer







What is meant by embedded Linux?
Last Answer : Linux is the operating system if we use this operating system in embedded system devices then it is known as embedded Linux. Linux is open source and free.

Show More

72 views 1 answer







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

Show More

223 views 1 answer







What is a semaphore? 
Last Answer : A resource management, synchronization, and locking tool. 

Show More

1 view 1 answer







State the methods of task synchronization. Describe semaphore with suitable example.
Last 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 ...   signal(Sem);  }  in process P2  {  wait(Sem);  S2;  }

Show More

190 views 1 answer







An intuitive manager could best be described as one who: A)uses scientific problem solving B)eliminates uncertainty in decision making C)searches out facts and data systematically D)uses an orderly approach to gathering information E)uses personal knowledge and experience to make decisions
Last Answer : E)uses personal knowledge and experience to make decisions

Show More

5 views 1 answer







Explain data transfer mechanism in I2C protocol. Compare it with CAN and USB protocol based on bit rate and area of applications.
Last Answer : I2C (Inter-Integrated Circuit): I2C stands for Inter-Integrated Circuit. I2C is a serial protocol. It was developed by Philips Semiconductor. I2C bus have two communication lines. One is serial data ( ... Mbps this is used for lower speed devices. Using USB we can connect upto 127 devices.

Show More

183 views 1 answer







The following were the features of the Nation state that emerged in Europe in the 20th century. a. The concept and practices of a modern state with sovereign centralised power developed in Europe. ... identified their nations. Mainly female figures were used to portray the nation. d. None of these
Last Answer : b. Nation state was supposed to be a state where majority of its citizens shared common identify and history.

Show More

30 views 1 answer







Firms that truly adopt the marketing concept develop a distinct organisational culture based on a shared set of beliefs that make __________ the pivotal point of the firm's decisions ... beating competitors B)increasing market share C)customers' needs D)marketing implementation E)marketing control
Last Answer : C)customers' needs

Show More

14 views 1 answer













How did underground railway help in solving housing problem ? -SST 10th
Last Answer : London Underground partially solved the housing crisis by carrying large masses of people to and fro the city.

Show More

1 view 1 answer







A transgenic food crop which may help in solving the problem of night blindness in developing countries is (a) Bt soybean (b) Golden rice (c) Flavr Savr tomatoes (d) Starlink maize.
Last Answer : b) Golden rice

Show More

4 views 1 answer







Pickup wrong definition 1) Off line - is a system peripheral equipment not controlled by CPU 2) Online - is system in which peripheral equipment is in direct contact with CPU 3) PL/I is the ... /Index 4) Program or routine is a set sequence of instructions given to computer for problem solving
Last Answer : 3) PL/I is the acronym Peripheral Listing /Index

Show More

6 views 1 answer







27 views 1 answer







Language is best thought of as Options: A) A biological (instinctive) development B) A system of symbols for effective problem-solving C) A nomenclature for cataloguing experience D) A medium for self-enhancement
Last Answer : C) A nomenclature for cataloguing experience 

Show More

19 views 1 answer







…………… can be defined as most recent and perhaps the most comprehensive technique for solving computer problems. A) System Analysis B) System Data C) System Procedure D) System Record
Last Answer : A) System Analysis

Show More

653 views 1 answer







What sort of problem solving do you do every day?
Last Answer : This question could be answered many ways. For me it is dealing with Bipolar. Simply because some days I battle to function. More importantly though, it is the shit my illness causes. Like when I simply ... precious now. I've learned a lot from this illness. Oddly I wouldn't change a thing! :)

Show More

1 view 1 answer







Which version of problem-solving method should I choose to keep my self-esteem due to almost-discovered lies?
Last Answer : answer:Which version should you choose? Do what you think is right.

Show More

0 views 1 answer







Did you hear anything about the space station having something to do with solving the problem of future radiation meltdowns?
Last Answer : No, the space station could not divert radiation. No possible way it could do that.

Show More

1 view 1 answer







How good at problem-solving are you (scenarios inside)?
Last Answer : answer:1. Get off the bus and call for a ride. 2. Hunker down and bust out my emergency kit, light some flares and wait for someone to drive by. A lot of this depends on where you've broken down. The ... for it. No one ever got out of a bad situation by freaking out, you have to think of a solution.

Show More

1 view 1 answer







What are some math applications and problem solving practice questions websites are pretty good to use to get ready for the CPT(college placement testing)
Last Answer : I am not familiar with any websites, but Kaplan and Barron both publish excellent test prep books for most college placement tests. These books usually come with cd's with problems and your local public ... public library doesn't, an academic library (local college or high school) might have a copy.

Show More

3 views 1 answer







What are the five stages in the Ladder of Problem Solving from "Thinking through Problem Solving"?
Last Answer : answer:http://www.changethis.com/21.ThinkingThrough The five stages: detection, inclination, capability, inquiry, skilled-response, and directed response. I know that's six. Maybe you only use one or the other of the last two?

Show More

0 views 1 answer







What's your weirdest approach to problem solving?
Last Answer : Put in an earbud and figure it out as you go

Show More

0 views 1 answer







Irrigation is very necessary for solving the food problem. -SST 10th
Last Answer : Agricultural crops are varied. Ample supply of water is required during the period of growth.

Show More

0 views 1 answer







The probability of A, B, C solving a problem are 1/3, 2/7 and 3/8 respectively. -Maths 9th
Last Answer : Let E1, E2, E3 be the eventsthat the problem issolved by A, B, C respectively and let p1, p2, p3 be corresponding probabilities. Then,p1 = P(E1) = \(rac{1}{3}\), p2 = P(E2) = \(rac{2}{7}\), p3 = P(E3) = \(rac{3}{8}\) ... }{8}\) = \(rac{25}{168}\) + \(rac{5}{42}\) + \(rac{5}{28}\) = \(rac{25}{56}.\)

Show More

0 views 1 answer







A problem in mathematics is given to four students A, B, C and D. Their chances of solving the problem -Maths 9th
Last Answer : Given, P(A) = \(rac{1}{2}\) ⇒ P(\(\bar{A}\)) = P(A not solving the problem) = 1 - \(rac{1}{2}\) = \(rac{1}{2}\)P(B) = \(rac{1}{3}\) ⇒ P(\(\bar{B}\)) = 1 - \(rac{1}{3}\) = \(rac{2}{3}\)P(C) = \ ... 3}{4}\)x \(rac{4}{5}\) = \(rac{1}{5}\)∴ P(problem will be solved) = 1 - \(rac{1}{5}\) = \(rac{4}{5}\).

Show More

0 views 1 answer







Problem solving
Last Answer : People crossed the bridge in groups of 2 and 3, Twenty one people crossed, How many groups of 2 were there, How many of 3?

Show More

0 views 1 answer







What thinking skills include creative thinking making decisions problem solving seeing things in the mind's eye and which other skill?
Last Answer : Need answer

Show More

4 views 1 answer







Is a form of problem solving in which the organism develops a sudden understanding of a problem's solution.?
Last Answer : Need answer

Show More

0 views 1 answer







What are the benefits of using mental models during problem solving?
Last Answer : Feel Free to Answer

Show More

1 view 1 answer







When did Alan Turing prove that a machine capable of processing a stream 1s and 0s of would be capable of solving any problem.?
Last Answer : 1942

Show More

0 views 1 answer







What is the academic discipline that relies most heavily on algorithms for problem solving?
Last Answer : What is the answer ?

Show More

1 view 1 answer







In the seven military problem solving process you have identified the problem. what is the next step?
Last Answer : gather information.

Show More

0 views 1 answer







Who can utilize technological design as a method to solving problem?
Last Answer : Anyone. C:

Show More

1 view 1 answer







In the method of problem-solving, a committee is set up to find a solution. (True/False)
Last Answer : Ans. True

Show More

6 views 1 answer







The component of an ICAI (Intelligent Computer Assisted Instruction) presenting information to the student is the? a) Student model b) Problem solving expertise c) Tutoring module d) All of the mentioned
Last Answer : c) Tutoring module

Show More

5 views 1 answer







A plan that describe how to take actions in levels of increasing refinement and specificity is ____________ a) Problem solving b) Planning c) Non-hierarchical plan d) Hierarchical plan
Last Answer : d) Hierarchical plan

Show More

3 views 1 answer







Solving a constraint satisfaction problem on a finite domain is an/a ___________ problem with respect to the domain size. a) P complete b) NP complete c) NP hard
Last Answer : b) NP complete

Show More

7 views 1 answer







What is the major component/components for measuring the performance of problem solving? a) Completeness b) Optimality c) Time and Space complexity d) All of the mentioned
Last Answer : d) All of the mentioned

Show More

11 views 1 answer







Web Crawler is a/an ____________ a) Intelligent goal-based agent b) Problem-solving agent
Last Answer : a) Intelligent goal-based agent

Show More

1 view 1 answer







A problem solving approach works well for ______________ a) 8-Puzzle problem b) 8-queen problem c) Finding a optimal path from a given source to a destination d) Mars Hover (Robot Navigation)
Last Answer : d) Mars Hover (Robot Navigation)

Show More

16 views 1 answer







The problem-solving agent with several immediate options of unknown value can decide what to do by just examining different possible sequences of actions that lead to states of known value, and then choosing the ... . This process of looking for such a sequence is called Search. a) True b) False
Last Answer : a) True

Show More

6 views 1 answer







What is the main task of a problem-solving agent? a) Solve the given problem and reach to goal b) To find out which sequence of action will get it to the goal state c) All of the mentioned d) None of the mentioned
Last Answer : c) All of the mentioned

Show More

2 views 1 answer







What is the term used for describing the judgmental or commonsense part of problem solving? a) Heuristic b) Critical c) Value based d) Analytical
Last Answer : a) Heuristic

Show More

6 views 1 answer






Show More⇦ PreviousNext ⇨