Закрыт

SEMEPHORA PROJECT

memory management library called sbmem.a

(buddy memory allocation from shared memory). Processes will use your library to

allocate memory space dynamically, instead of using the well-known malloc function.

A shared memory object, i.e., a shared memory segment, needs to be created first.

Memory space allocations will be made from that segment to the requesting

processes. Your library will implement the necessary initialization, allocation and

deallocation routines. Your library will keep track of the allocated and free spaces in

the memory segment. For that it will use the Buddy memory allocation algoritm [1,

2]. Study buddy algorithm first. It is and old and elegant algorithm. It is easy to grasp.

Your library will implement the following functions. The first two functions will be

used by programs that will create or destroy the shared segment to be used by other

processes.

• int sbmem_init (int segsize). This function will create and initialize a shared

memory segment of the given size. The given size is in bytes and must be a power

of 2. Memory will be allocated from that segment to the requesting processes

later. If operation is successful, the function will return 0, otherwise, it will return

-1. You will use POSIX shm_open() and ftruncate() functions in the

implementation of this function. If there is already a shared segment, the function

will destroy the segment first, before creating a new one with the same name.

After initialization, the shared segment will be ready to use. That means processes

can make memory allocation requests, and memory can be allocated from this

segment, if available.

• sbmem_remove (). This function will remove the shared memory segment from

the system. You will use shm_unlink () function to implement this. The function

will do all the necessary cleanup. For example, the created semaphore(s) will be

removed as well.

A process that would like to use the library for memory allocations will use the

following functions that you will implement in your library (sbmemlib.c).

• int sbmem_open(). This function will indicate to the library that the process

would like to use the library. In this way, the library can keep track of the

processes that are interested in using the library. The library will map the shared

segment to the virtual address space of the process using the mmap function. If

2

there are too many processes using the library at the moment, sem_open will

return -1. Otherwise, if the process can use the library, sem_open will return 0.

• void *sbmem_alloc (int reqsize). This function will allocate memory of size n,

which is the next power of 2 greater than or equal to reqsize. The reqsize is in

bytes. For example, if reqsize is 200 (bytes), then the library will allocate memory

of size 256, because 256 is the next power of 2 greater than or equal to 200. If

allocation succeeds, the function will return a pointer to the allocated space. It is

up to the program what to store in the allocated space. NULL will be returned if

memory could not be allocated. This can happen, for example, when there is not

enough memory.

Навыки: Программирование на C++, Алгоритмы, Java, Программирование на С, Архитектура ПО

Показать больше: project management processes ppt, pmbok project management processes, project management processes projectpmippt, processes techniques project management professional course ppt pdf, project management processes pmbok guide ppt, pmbok project management processes ppt, pmbok project management processes ppt slides, project management processes ppt slides, pmbok project management processes project ppt slides, project management processes project ppt, project management processes, outline project management processes, project management a systems approach to planning scheduling and controlling 12th edition pdf free, project management processes methodologies and economics pdf, project management processes methodologies and economics 3rd edition, 49 processes of project management pdf, project management processes that can be outsourced, the buffers supplied to non critical paths in critical chain project management are called, formal project management processes

О работодателе:
( 0 отзыв(-а, -ов) ) Ankara, Turkey

ID проекта: #29921137

1 фрилансер в среднем готов выполнить эту работу за $20

shabih2468

Greetings I saw your project and as an expert in C/C++ language I am sure I can do your task. I have previously worked on various C++ projects which includes making games, management systems projects and C++ is my prim Больше

$20 USD за 1 день
(59 отзывов(-а))
5.1