Know the platform (hardware/software) and the applications
Acquire various study resources of the subject:
Study the need and history of the subject
Identify the category of the subject among the below:
Any subject contains one or more blocks of knowledge:
Block = Knowledge burst + Understanding + Implementation + Exploring/Experimenting
Theory and concept may have single block of knowledge whereas, the rest may have multiple knowledge blocks.
While learning a block, there may be few tough parts that one cannot understand immediately. They are called holes. As we are proceeding to study, holes increased.
Without implementing one knowledge block, if you go to next block, you will find too many holes in it, which finally results to poor understanding on the subject.
Take gaps between the blocks but not in between one block; other wise it leads to ambiguity of concepts.
For every three to four months, once we have to recall the subject for not loosing it permanently.
Operating systems Design and Implementation :
Learning Computer Programming is a common need for people today. You may need C, C++ or VB Programming for your academic or you may be studying any independent Computer course for your future. Even after attending classes, if you are not able to master the programming, this material really helps you. The readers of this material are assumed as beginners in Programming.
Too small programs can be written only with main() without needing to define any external functions.
Medium and large Programs can be written into multiple Functions
If you write the Programs using Functions
To design the functions, remember the below principles:
Solving a Problem through programming requires these steps:
These three aspects are explained below
Inputs of a program can be taken from one of the below things, sometimes it can be few of below or all:
Before making the logic of the program, you must recall the set of language constructs and libraries that may be useful in the program.
Output may be displayed immediately or at the end or written to any secondary media such as file.
API seems to be very much similar to the built-in libraries of programming languages, comprising in-built functions to perform certain operations. However, an API differs from an ordinary library in below aspects:
An API can be characterized with below features:
Life Cycle - since the primary interest of an API is to interface with a resource or system concept; accordingly a life-cycle specification is provided. For example, for file-I/O, we must follow the order of opening buffers, performing I/O and closing them. One cannot perform I/O without opening the buffers. Thus, programmer is restricted to follow a predefined order for the usage of API functions.
Data types - If an API is meant for the interaction with a system resource or hardware, there must be a data type defined in that API to resemble that resource or hardware. For example, file-I/O API contains FILE data types may be C structures, Unions or C++ classes, which depends on the programming language for which API is written.
Handles - Although resource data types are given, their variables cannot be directly used to process the resource. One solution is to use the same data type pointers as handles. For example, to send a file can be used. Sometimes, the underlying resources may not any memory or attributes to be explicitly maintained. For such resources, handles can be simple integers comprising their identification details, rather than its data type pointers. For example to handle sockets, we use an integer called socket descriptor.
Factory Functions – A Function that creates a certain user-defined type variable’s instance and returns its handle is known as a factory function. The primary use of these factory functions is to avoid the code overheads for initializing the attributes of the data type. The handle returned by the factory functions can be captured into a program variable. For example, fopen is a factory function that returns a FILE pointer.
Life Cycle Functions – For changing the state of the resource and to make certain standard operations on the resource, few life-cycle functions are defined in API. For example, to close the file buffer fclose(), to rewind the pointer to update or clear the buffer fflush(), etc. the Life-cycle functions may not be used for data transfer with respect to the resource, rather they may not be used to control the resource.
Resource-I/O functions – With few resources such as files, network sockets we may need to make data transfers. API provides few resource-I/O functions for this purpose. For example, fprintf() and fscanf() are used to make file-I/O.
Transformation functions – sometimes one particular resource may be represented with multiple data types with different formats. In such case, conversion or transformation between them is possible through transformation function. For example on UNIX/LINUX Platforms time is represented by using two data types: time_t represents long format time and struct tm represents formatted time. The function localtime() converts time_t type time into the other type.
Constants – To represent certain predefined, fixed or constrained values, few constants such as macros are defined in API's. Eg: SEEK_OFFSET, SEEK_BEG, SEEK_SET.
To make a set of specification and designs primitives for writing API's and when to take a factory function and when to take an initialization function.
For many students including engineering and any bachelor degree in computers, C++ is an academic subject for their studies. Few people may need to attend for job interviews on C++ platforms. For all the above people this material would help to get comprehensive knowledge about C++ classes. Though I used to provide this material to my C++ students since past five years, I have decided to keep it in a global location, which is main intention behind keeping it here.
ceolivetalk All Rights Reserved.