Главная » Просмотр файлов » Smartphone Operating System

Smartphone Operating System (779883), страница 31

Файл №779883 Smartphone Operating System (Symbian Books) 31 страницаSmartphone Operating System (779883) страница 312018-01-10СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

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

One of its functions is to translatebetween logical and physical addresses. This is done by the operatingsystem setting a relocation register in the MMU and funneling all addressreferences through MMU translation using this relocation register. Therelocation register contains the first address in memory where the process’s memory space is placed. The MMU uses this scheme by addingthe value of the relocation register to memory references that go throughit. Figure 7.3 depicts this process.It is important to realize that the process that is executing knows onlylogical addresses and therefore uses only logical addresses. All referencesby the process are made to logical addresses.

It is the operating systemworking with the MMU that translates the references correctly. We callthe address space that the executing program references logical addressspace. The address space of real memory is called physical address space.The truth is that memory management is a complicated process. Herewe have just started to dig into what memory management is; we willadd to it in the rest of this chapter.

In the midst of all this complexity,MMUs are essential components.MMUs are basic processors with memory for operating system tablesand circuitry for fast searching and address computation. They do extensive bit-manipulation on addresses and lots of offset computation. TheyINTRODUCTION AND BACKGROUNDMMU143Memory109500CPURelocationregisterLogical address534+Physical address110034Figure 7.3 Translating a logical address to a physical addressdo not have to be very powerful with respect to computation but they dohave to be fast. Some of their memory is very fast (for example, translationlook-aside buffers).MMUs are so essential to some operating systems that these operatingsystems are not implemented on systems without an MMU.

MicrosoftWindows CE and Linux, for example, assume the presence of an MMU.Dynamic Loading and LinkingIt is tempting to see the amount of memory that modern desktop computersuse and not worry about how much memory is used by an application.However, reducing the memory required for programs is still a rewardedendeavor, especially on smaller devices. Dynamic loading and linkingare techniques that can be used to reduce memory requirements.Dynamic loading can be used to distribute load costs and to eliminatememory waste. When using dynamic loading, a process only loads theportions of a program that it needs into memory.

Often a program is brokenup by function definitions, but it can also be in larger units – such asclasses or groups of code. When the operating system starts a program thatuses dynamic loading, only the main program is loaded and executed.The main program loads classes or functions before using them. Theadvantages here are that code that is never called is not loaded intomemory. In addition, the operating system does not have to go into kernel144MEMORY MANAGEMENTmode. Dynamic loading is almost always a technique that user programsimplement.Using overlays is also a technique to save memory or to work inmemory-restricted environments. As with dynamic loading, a programthat uses an overlay method is broken up into pieces. These piecesare loaded into memory by the program itself in such a way that theyoverlay the memory of the currently executing program. The overlaidcode occupies the same memory space as the program code that loaded.This, in effect, rewrites the program’s code.

The newly overlaid code isthen executed.As with dynamic loading, overlaying code requires no help from theoperating system. No translation of addressing is required. The spacetaken up by the executing code is constant – the overlaid code takesthe same space as the code it replaces. However, this method suffersfrom the performance delays of I/O. It was used often for older operatingsystems, in the days when 640 KB of memory was the norm for personalcomputers. It was not uncommon to be using an application, only to havethe application freeze up while the overlay was read and installed.A variation of dynamic loading is called dynamic linking.

Linking is theaction of joining modules of compiled code – including those suppliedas libraries by the operating system – together with user object modulesso that a complete executable can be run. Some systems employ staticlinking, which combines the libraries with user code before executiontime. Dynamic linking links system libraries with user code when they areneeded during execution and allows the system libraries to be linked frommemory where they are loaded. If a library is already in memory fromlinking with another application, then it stays in memory where it is andis linked from that location. When dynamic linking is used, somethinghas to alert the operating system to perform the dynamic library link.A small bit of code – called a stub – is statically linked in place of theactual library implementation of the system call.

This code stub performsthe dynamic link and replaces itself with the address of the dynamicallyloaded implementation.There are several advantages to this scheme. First, libraries are notloaded until they are needed. Secondly, loading cost is distributedthroughout the life of the executing application. Thirdly, libraries areloaded only once and it is possible that there is no load cost for manyapplications (especially for a commonly used library). Finally, all theseadvantages mean that program size will be smaller.

Since libraries arenot statically linked, programs carry fewer bytes of code when they areSWAPPING AND PAGING145loaded for execution. When Sun Microsystems went from using staticallylinked code in its operating system to dynamically linked code, the sizeof its executable programs dropped by 60%.Modern operating systems use dynamic linking as a way to minimize memory space used by applications. With the copious amountsof memory that come with computers, overlays and dynamic loadingmechanisms are not needed.7.2 Swapping and PagingAs shown at the end of Figure 7.1, a process’s code must be in memoryfor the computer to execute it.

However, every process that has been inthe running state also needs code in memory. This means that processesmust share memory in the same way as they share the CPU.Swapping Memory AreasOne obvious way to do this that we have already discussed would beto store the image currently in memory, erase memory, and move thememory image of the new process into memory before execution.

Thissequence is called swapping and is at the heart of how processes actuallyshare memory. Swapping requires some kind of storage in which to storethe memory images between context switches. Typically, this is doneusing fast hard disk space.A process that is swapped out to a storage area (such as a hard disk)by this method can sometimes be swapped back from that storage areato the same spot in memory. This can be advantageous, especially forcertain methods of address binding. If absolute binding is used, set up atcompile time, then a process’s memory image is required to go in exactlythe same memory location – dictated by the compilation process – eachtime.

However, if relocatable binding is used, then a process can goanywhere in memory, because physical addresses are always calculatedfrom logical addresses for each memory reference.Notice that with swapping time added, context switching becomes avery expensive activity.

Switching time is composed of process switching – the movement of PCBs through queue data structures – and themovement of memory areas.Let’s say that a process requires 2 MB of memory and that the diskdrive used for storage has a transfer rate of 10 MB per second. The transfer146MEMORY MANAGEMENTrate of this memory swap is equal to2 MB/10 MB per second = 1/5 second = 200 millisecondsIf we assume a generic disk drive with an average latency of 9milliseconds, our swap time is 208 milliseconds for one swap.

Since thereare two swaps – one out and one in – the swap time is 416 milliseconds.This is in addition to other costs of process switching.Obviously, we want to reduce swap time as much as possible. Oneway to do this is to focus on the storage medium.

If we could increase thetransfer rate of memory data, we could lower the cost, as measured bythe amount of time needed to perform a context switch. Using solid-statememory is an option: compact flash memory can transfer as fast as 66 MBper second and Secure Digital cards can transfer data up to 133 MB persecond.

While this is an option, using flash memory is an expensive wayto reduce swap time on a general-purpose machine.Another way to reduce swap time is to reduce swapping itself. Ifwe could reduce the amount of swapping that was required – perhapseliminate the need to swap altogether – this would obviously be a greatreduction in context switching overhead. This is something that operatingsystems try very hard to do. To understand this, we must develop ideas ofmemory paging.Memory PagingThe idea of paging has its roots in the availability of physical memory.When the physical memory available on a computer is many times therequirements of a process’s memory space, most of the large memory iswasted. If, however, we allow several memory images to occupy physicalmemory at once, not only can we use more memory but we might alsobe able to avoid swapping altogether (if all our memory images can fitinto physical memory).To implement this idea, we need some definitions.

Physical memoryis usually divided into blocks of fixed size called frames. Logical memoryis analogously divided by the operating system into pages, which arealso blocks of fixed size. To facilitate fast swapping, the storage mediumis usually also divided into blocks, with each block the same size as aphysical-memory frame.

Similarly, it is best that the page size be at leastsome multiple of the frame size.Now, when a process needs memory space, its code and dataare brought from storage into memory in pages that are placed inSWAPPING AND PAGING147physical-memory frames. When other processes need their pages to bebrought into memory, these pages are loaded into physical-memoryframes that are unoccupied. When a process terminates, its memorypages are removed from physical memory.Now let’s free up our ideas of swapping. If the operating system cantranslate addresses and can keep track of where pages are in memory,then there really is no need for process pages to be contiguous.

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

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

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

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