Re: request to rectify my doubts

1 view
Skip to first unread message

Dr Raj Kamal

unread,
Feb 28, 2012, 5:48:01 PM2/28/12
to alka dubey, MtechES, MTech ES 2011_13
Dear Students,
1. There are number of Inter process Communication functions. Semaphore
functions are the subset of the set of Inter process Communication
functions. A semaphore is posted (released, given) or is taken (pending) or
is accepted or queried or created or deleted. It can be a binary number or
an integer or unsigned integer.
2. Process is the term used in Unix or Linux or some OS, and can have
multiple threads. Then the thread is the scheduled by OS. PCB can have
thread stacks as its subset.
Task is the term used in VxWorks or MuCos or Windows CE, and can create
another task. The task is the scheduled by OS. TCB has information about
the task only.

3. lock() and unlock() functions and enable and disable interrupt functions
(I) Lock function (or macro) is used for disabling execution of other tasks
but does not disable high priority interrupt. Lock function can be used in
task. Lock is used for disabling other tasks so that no higher or low
priority task can now execute first. (Disables the OS Scheduler)
(II) UnLock function (or macro) is used for enabling execution of other
tasks. UnLock function can be used in a task. UnLock is used for enabling
other tasks so that higher priority task can now execute first. (Enables
the OS Scheduler)

(III) Enable interrupt function (or macro) is used for enabling execution of
interrupt functions (ISRs) including the tasks so that high priority
interrupt or task can execute first. Enable interrupt function can be used
in task or ISR. Enable interrupt is used for enabling other interrupts
including tasks so that higher priority interrupt or task can execute first.
(IV) Disable interrupt function (or macro) is used for disabling execution
of interrupt functions (ISRs) including the tasks so that present interrupt
function or task can continue execution first. Disable interrupt function
can be used in task or ISR. Disable interrupt is used for disabling other
interrupts including tasks so that no other interrupt or task can execute,
till present one finishes and interrupts have to enabled again.
(V) Pend or take function is used for enabling execution of task codes if
the required semaphore is released elsewhere for which the present task was
waiting. When in that set of codes the task section executes on taking the
semaphore and after that section of codes finishes it releases semaphore for
another task codes, then the semaphore is called mutex also. This is because
access to two or more task codes sharing same semaphore is mutually
exclusive.

4. Critical sections can use one of the three pair of functions (I) Disable
and Enable interrupts or (II) Lock and Unlock or (III) SemPend and SemPost,
It depends whether critical codes should (I) disable and enable any other
task as well as ISR or (II) disable and enable any other task but not the
ISR or (III) disable and enable any other task section which is sharing the
same semaphore (mutex).

First consideration is use of mutex, it blocks those tasks only which are
waiting for the same mutex.
Second consideration is use of Lock, it blocks other tasks but not the
interrupt functions.
Third consideration is use of disable interrupts. it blocks other tasks as
well as interrupt functions.

Spin lock is an OS variable, shared between the tasks. Execution of Pend or
Post function takes more task-switching time because there is context
switching. Spin-lock is simple and takes just one instruction to communicate
to a task from the OS.

Yes, Syllabus I told us that do preparation of chap 7 complete and in chap 8
all the portion before RTOS I.e. between Sections 8.1 to 8.6.

With best wishes,
Raj Kamal

--
your Sincerely
Dr. Alka Dubey
Lecturer
School of Electronics
Devi Ahilya University, INDORE (M.P.)

Reply all
Reply to author
Forward
0 new messages