3

I am looking at doing some low level programming, writing a basic operating system. I am familiar with relational databases, so I am wondering if copying the methods data is stored in web aps (MySql, SQL Server etc) is a good way to store data in memory for an operating system. This would all be just for the operating systems tasks, and such. By "good way", I mean speed mostly, but of course elegance and good architecture are factors too. I assume that most operating systems favour speed over design patterns for this? I have no experience with low level Linux, so I want to know if a relational database is a sound starting point for writing a memory manager.

Yasushi Shoji
  • 4,028
  • 1
  • 26
  • 47
Eric Vi4ing
  • 303
  • 1
  • 4
  • 9
  • Would you mind to clarify _"copying the methods data is stored in web aps is a good way to store data in memory for an operating system"_? – Yasushi Shoji Aug 17 '12 at 04:28
  • I basically mean the algorithms used to implement database transactions. – Eric Vi4ing Aug 17 '12 at 05:05
  • Ok. Just a simple question: what do you do when your algorithms needs to allocate memory? – Yasushi Shoji Aug 17 '12 at 05:48
  • malloc? Is that what you mean? – Eric Vi4ing Aug 17 '12 at 06:48
  • I mean, who provides malloc? On your OS, applications call your database transaction-like memory management API, then the API call malloc() as you said, now, how does malloc get memory? Usually, OS provides lower level API, which is called `system call`s. In the case of Linux, it is sbrk() or mmap(). http://stackoverflow.com/a/3479496/640650 . Once you passed system call boundary, you are in kernel memory management. :-) – Yasushi Shoji Aug 17 '12 at 07:05

1 Answers1

2

No.

Memory management in an OS is a whole service of managing memory. That includes interfaces to the applications, the way to manage bare metal memory region, memory protection control, virtual memory mapping management, to list a few.

Database transaction is, on the other hand, a concept of ACID (atomicity, consistency, isolation, durability). It is to provide interfaces to users who want ACID attributes. It might be interesting, though, if your OS provides database transaction like interface to the applications, if it applicable.

The reason most, if not all, OSes favor speed is that all existing CPU power is to run applications. There is no reason to manage hardware, or provide services, if there is any applications to run. But this is not always true. OS designers, sometime, favor design or clarity over a bit of speed, for manageability. So the answer is, as always, "It depends."

Yasushi Shoji
  • 4,028
  • 1
  • 26
  • 47