views:

151

answers:

1

While Developing an OS Abstraction layer for a multi-modular system, which approach should one take:

  1. Create a Shared Library of OS services and each module is built to use it and runs as individual processes. OR
  2. Create only a single instance of abstraction layer which provides memory, timer services and which alone spawns all instances of modules.

What are the pros and cons of these approaches? Also lay down any other if possible?

+1  A: 

Back when it was my job to architect, manage and lead (mostly by-doing;-) such layers, I had an easy time deciding: some operating systems (VMS, then-brand-new Win-NT) had very heavy-weight process spawning (so it really needed a lot of provocation to spawn a new process!-), while at the other extreme others (such as BSD 4.3 with its then-brand-new vfork!-) positively encouraged you to spawn as many processes as you wished and had very little overhead in doing so. Therefore, I judged that leaving to the application programmers the decision of whether to spawn or not was irresponsible - we (the "Base Libraries" group) really had to provide an abstraction layer that would spawn or not depending on the underlying operating system. It worked pretty well... but also it was 15/20 years ago, on a certain class of machines (workstations) with a wide variety of OS's but reasonably uniform endowments in memory, cores (one: no multi-cores back then!-) and the like.

Were I to take the same job today, I'd first push the stakeholders (top mgmt, product marketing, or whoever) for a clear definition of the range of platforms we have to support -- what OS's, what range(s) of HW endowments. If -- as I suspect -- that's as wide in its way as it was back then, my architecture would be similar in terms of hiding the concept of process spawning from application programmers. But maybe the target range is different, e.g. "smartphones and cheap netbooks", which would make the choice iffier... though abstracting process creation away from app programmers is the SAFE choice, and you should expose this layer only if you're willing to take a risk on said app programmers' general skills AND whatever uniformity you can count on now in your range of platforms, remaining reasonably stable in the future!-)

Alex Martelli
Thnx Alex for your time.Based on your answer, wht advantages would one actually get if 'one' can design a Process based Multi-Modular system with Daemon processes for Common Services like 'logging' over Single-Process Multi-threaded architecture?Given that the architecture and OS favours this design.
Sashi
@Sashi, multi-process has the huge advantage of easily translating to clusters (not just shared-memory machines -- where cores keep getting added, but the bandwidth to shared memory is **already** the bottleneck anyway!-). Were I designing a new architecture now I'd bet the barn on message-passing to the exclusion of _any_ shared-memory requirements, as that unlocks unlimited scalability (and message-passing, to this level of abstraction, translates to separate processes -- which you can _implement_. if and when that's still needed, as threads, but, **not** vice-versa...!-).
Alex Martelli