OSDev.org

The Place to Start for Operating System Developers
It is currently Sat May 25, 2019 6:56 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: The Terrific Tell and Talk Thread
PostPosted: Mon Apr 29, 2019 3:52 pm 
Offline
Member
Member
User avatar

Joined: Fri Feb 17, 2017 4:01 pm
Posts: 361
Location: Ukraine, Bachmut
Solar, kewl. I definitely consider your C library as CRT for my project when it will be something more than just babbling, untested pieces of mess, unimplemented ideas and jerky loader. :mrgreen: The words "compliance" and "minimalism" are so pleasant to the ears.

_________________
future big goal: ANT - NT-like OS for mips, arm and x86.
current smaller goal: efify - UEFI for a couple of boards (mips and arm).


Top
 Profile  
 
 Post subject: Re: The Terrific Tell and Talk Thread
PostPosted: Tue Apr 30, 2019 9:57 am 
Offline
Member
Member

Joined: Thu May 17, 2007 1:27 pm
Posts: 570
Time for another update on managarm: a few weeks ago, I implemented write support for ext2fs. With all the page cache and writeback infrastructure in place (which I wrote about in my previous post), this was surprisingly simple. Basically, to create new files, the driver just needs to map block allocation bitmaps, inode tables and directory structures into virtual memory. After that is done, it modifies them in place and triggers a writeback. Modifying file data is even more simple: here, the driver just maps the file and does a memcpy() to modify the mapped pages. Again, a writeback is triggered subsequently. What I find particularly appealing is that no direct writeSectors() call is required in any of the write operations -- those are done transparently by the page cache.

_________________
managarm: A microkernel-based OS that is capable of running a Wayland desktop


Top
 Profile  
 
 Post subject: Re: The Terrific Tell and Talk Thread
PostPosted: Fri May 03, 2019 8:04 am 
Offline
Member
Member
User avatar

Joined: Mon May 22, 2017 5:56 am
Posts: 55
Solar wrote:
[*] Integration of dlmalloc; PDCLib now has decent memory management.

Thanks for the link, I've filed it. I may not be working with C, but I will need decent memory management. This article contains some useful guidance.

_________________
It's Forth, Jim, but not as we know it!


Top
 Profile  
 
 Post subject: Re: The Terrific Tell and Talk Thread
PostPosted: Fri May 03, 2019 9:11 am 
Offline
Member
Member
User avatar

Joined: Thu Nov 16, 2006 12:01 pm
Posts: 7365
Location: Germany
eekee wrote:
I may not be working with C, but I will need decent memory management. This article contains some useful guidance.


From an OS designer's perspective, it's an easy trap to fall in: Lumping everything together under the label "memory management".

I found that it's "better" to, in your mind, realize that it's two separate things, really.

On the one hand you have the kernel doing the MMU / paging / address space setup thing. It also needs to provide some way(s) to pass out memory to user space. This is not malloc() / free(), though. It's more in the terms of brk() / sbrk() / mmap() / whatever_your_idea_is(), i.e. the system calls that a malloc() implementation like dlmalloc, or ptmalloc, or Your_Languages_Interpreter interfaces with.

On the other hand you have the user-space support library. malloc() / calloc() / realloc() / free() / etc. for standard C; this gets memory from the kernel in bulk (brk() / sbrk() / mmap() / ...) and does the smart parceling out / reclaiming.

There might be some need for a kernel function that passes out sub-page sized memory bits to the kernel proper, like kmalloc(). (Which might or might not use similar logic to user-space malloc().) But for architecture, I feel it's important to keep the system calls (brk() / sbrk() / mmap() / ...) and the user lib calls (malloc() / ... / free()) separate in your head.

Just sayin'. It took me some confused hours back in the day to figure that one out on my own. ;-)

_________________
Every good solution is obvious once you've found it.


Top
 Profile  
 
 Post subject: Re: The Terrific Tell and Talk Thread
PostPosted: Fri May 03, 2019 9:31 am 
Offline
Member
Member
User avatar

Joined: Mon May 22, 2017 5:56 am
Posts: 55
Thanks! :D I was headed for confusion, I think. I'm aware they're normally separate, but with so many architectural decisions still up in the air, I risk conflating different systems all the time.

_________________
It's Forth, Jim, but not as we know it!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group