flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > About malloc()? |
Author |
|
baldr 04 Aug 2013, 15:18
ivan_tux,
It should, so it can track those mallocations and free()s. Bitmaps can be used too. Every program do have private addressing space, yet they share the same physical memory. |
|||
04 Aug 2013, 15:18 |
|
ivan_tux 05 Aug 2013, 01:00
baldr wrote: Every program do have private addressing space, yet they share the same physical memory. Hmm.. It sounds confused if programs share the pool area. If the pool is full, malloc call morecore or sbrk to alloc new pages. Then how each program can know new pool area that doesnt mapped to the programs' address space? Or, maybe morecore map new allocated pages to each programs? |
|||
05 Aug 2013, 01:00 |
|
comrade 05 Aug 2013, 02:44
In protected mode, different processes run in their own address space. Read up on virtual memory.
|
|||
05 Aug 2013, 02:44 |
|
ivan_tux 05 Aug 2013, 03:06
comrade wrote: In protected mode, different processes run in their own address space. Read up on virtual memory. Yes i know. And we can share pages to another process. Then, how about malloc? Does malloc manage pages from address space of current process that requests allocation. or from pages that allocated by malloc itself, and this pages shared and managed for all programs that request allocation? Rrrr... It confuse... |
|||
05 Aug 2013, 03:06 |
|
revolution 05 Aug 2013, 03:47
Since you posted this in OS Construction then can we assume you are writing your own OS? If so then there is no rule for malloc that you must follow. Just do whatever makes sense for your OS. Make malloc do whatever you want/need.
|
|||
05 Aug 2013, 03:47 |
|
dogman 05 Aug 2013, 07:03
Why use malloc() at all? Does the world really need another *NIX clone? Death to POSIX!!!
|
|||
05 Aug 2013, 07:03 |
|
revolution 05 Aug 2013, 07:14
comrade wrote: In protected mode, different processes run in their own address space. |
|||
05 Aug 2013, 07:14 |
|
ivan_tux 09 Aug 2013, 23:28
dogman wrote: Why use malloc() at all? Does the world really need another *NIX clone? Death to POSIX!!! |
|||
09 Aug 2013, 23:28 |
|
Bargest 10 Aug 2013, 07:43
ivan_tux wrote: It says that the function should create linked-list to keep allocation information. There are many different ways to manage memory. It is just one of them. ivan_tux wrote: My question is, where i should put it? If this function manages physical memory, the list should be global. I use big memory pages (2 MB each), allocate physical memory by pages and store memory bitmap. For 512 GB physical memory it consumes 32kb of map. If it manages virtual memory of process, the list should be local. But creating such function is not essential for OS, any program can create its own functions and use them for managing user's part of virtual memory. _________________ jmp $ ; Happy end! |
|||
10 Aug 2013, 07:43 |
|
DOS386 10 Aug 2013, 08:37
An OS usually keeps track about what app owns what memory. If the app gets assassinated, the memory owned by it is automatically getting freed. So no absolute need for a demalloc at app exit. This works even in good old DOS ("MCB chain").
> Why use malloc() at all? Does the world really need > another *NIX clone? Death to POSIX!!! Good point. BTW, I deprecate malloc & Loonix too. But for a better OS, you need better hardware too: http://board.flatassembler.net/topic.php?t=14900 |
|||
10 Aug 2013, 08:37 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.