Главная » Просмотр файлов » Wiley.Symbian.OS.Internals.Real.time.Kernel.Programming.Dec.2005.eBook-DDU

Wiley.Symbian.OS.Internals.Real.time.Kernel.Programming.Dec.2005.eBook-DDU (779891), страница 18

Файл №779891 Wiley.Symbian.OS.Internals.Real.time.Kernel.Programming.Dec.2005.eBook-DDU (Symbian Books) 18 страницаWiley.Symbian.OS.Internals.Real.time.Kernel.Programming.Dec.2005.eBook-DDU (779891) страница 182018-01-10СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 18)

Valuesbetween 0 and 63 represent absolute priorities; values between −8 and−2 represent priorities relative to that of the owning process.iHandlesPointer to array (DObjectIx) of thread-local handles for this thread.iIdSymbian OS thread ID of this thread (unsigned 32-bit integer).iAllocatorPointer to the user-side heap being used by this thread. This is stored bythe kernel on behalf of the user code and is not used by the kernel itself.iExceptionHandlerPointer to this thread’s user-side exception handler.

This will be invokedin user mode in the context of this thread if a handled exception occurs.iExceptionMaskBit mask indicating which types of exception the user-side exceptionhandler handles. These are defined by the enum TExcType.iExcTrapPointer to the thread’s exception trap handler. The handler will be invokedif an exception occurs in the context of this thread. The trap part of thehandler provides the ability to return to the beginning of a protected codesection with an error code.

NULL if no such handler is currently active.iDebugMaskPer-thread debug mask. This is ANDed with the global debug mask togenerate the debug mask used for all kernel tracing in the context ofthis thread.iKernMsgKernel-side message sent synchronously to kernel-side threads. Used forcommunication with device driver threads.70THREADS, PROCESSES AND LIBRARIESiOwnedLogonsDoubly linked list of thread logons owned by this thread (that is, this threadis the one which requests notification of another thread terminating).iTargetLogonsDoubly linked list of thread logons whose target is this thread (that is,another thread requests notification if this thread terminates).iSyncMsgSymbian OS IPC message (RMessageK) reserved for sending synchronousIPC messages.iKillDfcThe Symbian OS exit handler returns a pointer to this DFC when thethread terminates.

The nanokernel queues the DFC immediately beforeterminating the thread. The DFC runs in the context of the supervisorthread and is used to clean up any resources used by the thread, includingthe DThread object itself.iClosingLibsThis is a doubly linked list holding a list of DLibrary objects whichrequire user-side destructors to be called in the context of this thread.iMStateThis is actually the iSpare1 field of iWaitLink. It indicates the stateof this thread with respect to Symbian OS wait objects.iWaitLinkThis is a priority queue link field used to link the thread on to the waitqueue of a Symbian OS wait object.

Note that the priority of this linkshould always be equal to the thread’s nanokernel priority.iWaitObjThis is a pointer to the Symbian OS wait object to which this thread iscurrently attached, NULL if the thread is not attached to any wait object.iSupervisorStackBase address of thread’s supervisor mode stack.iCleanupQPriority-ordered list (64 priorities, same structure as scheduler) usedto hold callbacks to be invoked if the thread terminates. Also usedto implement priority inheritance – adding a high-priority cleanup queueentry will raise a thread’s priority. Thread scheduling priority is calculatedas the maximum of iDefaultPriority and the highest priority of anyentry in the cleanup queue.iNThreadThe nanokernel thread control block corresponding to this thread.SYMBIAN OS THREADS713.3.3 Types of Symbian OS threadThere are four types of Symbian OS thread, which are determined by theiThreadType field in DThread.

This takes on one of the values in theenumeration TThreadType.iType==EThreadInitialThere is only ever one initial thread in the system, and this is the firstthread to run on a device at boot time. This thread’s execution beginsat the reset vector and eventually becomes the null thread, which isthe thread with the lowest possible priority in the system. For more onSymbian OS bootup, see Chapter 16, Boot Processes.iType==EThreadSupervisorSupervisor threads run only in supervisor mode, never in user mode. Thememory model allocates a supervisor stack for these threads; you mayvary its size by passing in a parameter during thread creation. Usually itis best to pass in a value of 0, which tells the kernel to use the default sizeof 4 KB (one page).Supervisor threads have time slicing enabled by default, with a timeslice of 20 ms.iType==EThreadMinimalSupervisorThese threads are intended for use by RTOS personality layers and aresimilar to supervisor threads.

The key requirement for an RTOS threads isa fast creation time, so the kernel does not give these threads.The memory model can allocate the supervisor stack just as it doesfor supervisor threads, but if you wish, you can preallocate an area ofmemory and pass a pointer to it when you create the thread.Finally, RTOS threads generally don’t need time slicing, so we disableit by default.iType==EThreadUserThese are the threads used to run standard user applications. They run inuser mode for most of the time, although they do run in supervisor modeduring executive calls.As we have seen, these threads have two stacks, a user-mode oneand a supervisor-mode one; the memory model allocates both of thesedynamically.

The memory model allocates the supervisor stack in thesame way as for supervisor threads, with a default stack size of 4 KB. Itallocates the user stack during thread create time; it creates the user stackin the address space of the process to which the thread belongs. (I willdiscuss this in more detail in Chapter 7, Memory Models.) The creator ofa user thread can specify the size of the user stack at creation time.User threads have time slicing enabled by default, with a timeslice of20 ms.72THREADS, PROCESSES AND LIBRARIES3.3.3.1 Identifying Symbian OS and personality layer threadsThe easiest way to determine if a given NThread is a Symbian OSthread or belongs to an executing personality layer is to examine thenanothread’s handlers:// additional thread event handlers for this NThreadSNThreadHandlers* NThreadBase::iHandlers()The function I use looks like this:SNThreadHandlers *gEpocThreadHandlers;//////////Grab the thread handlers from a thread that weknow is a Symbian OS thread.The extension and DLL loader is guaranteed to bea Symbian OS thread, so we can use an extensionentry point to capture its thread handlers.// Extension entry pointDECLARE_STANDARD_EXTENSION(){gEpocThreadHandlers=(SNThreadHandlers*)CurrentThread()->iHandlers;...}// Get Symbian OS thread from a NThread// if there isn’t one, it’s a personality// layer thread, return NULL.DThread *GetEpocThread(NThread *aNThread){if (aNThread->iHandlers != gEpocThreadHandlers)return NULL; // personality layer threadDThread* pT = _LOFF(aNThread, DThread, iNThread);return pT;}The method I use is quite simple.

First, in a global variable I save apointer to the handlers of the extension and DLL loader (a thread that isknown to be a Symbian OS thread). Then, later, I compare my thread’snanothread’s iHandlers pointer, and if it is the same as the globalvariable, then my thread is a Symbian OS thread too.3.3.4 Symbian OS thread lifecycle3.3.4.1 Symbian OS thread statesEach Symbian OS thread has a state, known as the M-state. (This isin addition to the N-state of each Symbian OS thread’s embeddednanothread.) When the Symbian OS thread waits on or is released froma Symbian OS semaphore or mutex, its M-state changes.SYMBIAN OS THREADS73The M-state may take on any of the values in the enumerationTThreadState – a complete list follows.

An RTOS may add moreM-states; I’ll discuss this further in the next section, 3.3.4.2.iMState==ECreatedThis is the initial state of all Symbian OS threads. It is a transient state – thekernel puts the thread into this state when it creates the DThread controlblock and keeps the thread in this state until the kernel is ready to resumeit, at which point it changes the state to EReady.iMState==EDeadThis is the final state of all Symbian OS threads. A thread enters this statewhen it reaches the end of its exit handler, just before the nanokernelterminates it.iMState==EReadyA thread is in this state when it is not waiting on, or attached to,any Symbian OS kernel wait object (semaphore or mutex).

Характеристики

Тип файла
PDF-файл
Размер
6,63 Mb
Материал
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
Как Вы думаете, сколько людей до Вас делали точно такое же задание? 99% студентов выполняют точно такие же задания, как и их предшественники год назад. Найдите нужный учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6418
Авторов
на СтудИзбе
307
Средний доход
с одного платного файла
Обучение Подробнее