World's most popular travel blog for travel bloggers.
Showing posts with label MCS041. Show all posts
Showing posts with label MCS041. Show all posts

Operating Systems

Non contiguous memory allocation methodology does require that a file be termed at the start. The file grows as needed with time. A major advantage is the reduced waste of disk space and flexibility when it comes to memory allocation. The Operating System will allocation memory to the file when needed.
Non contiguous memory allocation, offers the following advantages over contiguous memory allocation:
  • Allows the interdependence of code and data among processes.
  • External fragmentation is none existent with non contiguous memory allocation.
  • Virtual memory allocation is strongly supported in non contiguous memory allocation.
Non contiguous memory allocation methods include Paging and Segmentation.

Paging

Paging is a non contiguous memory allocation method in which physical memory is divided into fixed sized blocks called frames of size in the power of 2, ranging from 512 to 8192 bytes. Logical memory is also divided into same size blocks called pages. For a program of size n pages to be executed, n free frames are needed to load the program.
Some of the advantages and disadvantages of paging as noted by Dhotre include the following:
  • On advantages:
  • Paging Eliminates Fragmentation
  • Multiprogramming is supported
  • Overheads that come with compaction during relocation are eliminated
  • Some disadvantages that include:
  • Paging increases the price of computer hardware, as page addresses are mapped to hardware
  • Memory is forced to store variables like page tables
  • Some memory space stays unused when available blocks are not sufficient for address space for jobs to run

Segmentation

Segmentation is a non contiguous memory allocation technique that supports a user view of memory. A program is seen as a collection of segments such as main program, procedures, functions, methods, stack, objects, etc.
Some of the advantages and disadvantages of segmentation as noted by Godse et al include the following:
  • On advantages:
  • Fragmentation is eliminated in Segmentation memory allocation
  • Segmentation fully supports virtual memory
  • Dynamic memory segment growth is fully supported
  • Segmentation supports Dynamic Linking
  • Segmentation allows the user to view memory in a logical sense.

  • On the disadvantages of segmentation:
  • Main memory will always limit the size of segmentation, that is, segmentation is bound by the size limit of memory
  • It is difficult to manage segments on secondary storage
  • Segmentation is slower than paging
  • Segmentation falls victim to external fragmentation even though it eliminates internal fragmentation

Discuss in detail the features, Process management, Memory management, I/O and File management and Security and Protection in Windows 10 Operating System.


Features

  • There's loads of stuff for touch, but it's different stuff
  • Office Apps Get Touch Support
  • Universal Apps
  • Improved Multitasking
  • Continuum
  • Start Menu Returns
  • Action Center
  • Unified Settings / Control Panel
  • Cortana on Desktop
  • Improvements to Windows Explorer
  • Snap Assist helps you snap windows
  • The Command Prompt enters the 21st Century

Process management


Memory Management



File Management

In Windows 10, Microsoft is making many improvements regarding storage. For starters, the new version has a much smaller footprint for installation. If you're making a clean install, you'll notice that Windows 10 takes a lot less space, often less than 10 GB.
Through the Settings app on System > Storage, users can easily manage their storage space, and move default saved locations to an external hard drive. You can even click on each hard drive to view what's taking up space in your system. Very useful information and very easy to use for beginners.
Quick Access ToolbarHere you can pin your most frequently accessed commands. Quick Access also automatically pins your most frequently accessed folders.
Ribbon ToolbarIf you are familiar with Microsoft Office or apps such as Paint and WordPad, the Ribbon toolbar command is used to manage your files and often reveals hidden commands quickly. When you select a file or folder, this will display a contextual tab with additional options. You can copy, move, delete, rename, and a host of other tasks using the Ribbon.
Navigation and Address BarYou can use these to navigate smoothly through a folder’s hierarchy or back and forward between folders. The Address bar also has a breadcrumb menu that makes it easy to navigate to a different folder path.
Quick AccessHere you can find your most frequently accessed folders and also ones you have pinned show up here, which is a new feature in Windows 10.
OneDrive synced foldersIf you have a Microsoft Account setup with your Windows 10 PC, you can have your files stored in the online storage service and have them synced to your computer.
This PCIn previous versions of Windows, this was called Computer Explorer. Here you can view and manage your internal storage and attached storage devices including optical media.
SearchUse the search command to find files stored in the current folder.
Status barDisplays information about the contents stored in the window, such the amount of files, size, file selection and quick access to folder layout.

Windows 10 security

  1. Threat resistance
  2. Virtualization-based security
    • Hypervisor Code Integrity (HVCI).
    • Local Security Authority (LSA).
  3. Device Guard
  4. Configurable code integrity
  5. Measured Boot and remote attestation
  6. Improvements in Windows Defender
  7. Information protection
  8. Windows Information Protection
  9. Improvements in BitLocker
  10. Identity protection and access control
  11. Microsoft Passport
  12. Windows Hello
    • Facial recognition.
    • Fingerprint recognition.
    • Iris recognition.
  13. Credential Guard




Windows 10 featureTPMInput/output memory management unitVirtualization extensionsSLATUEFI 2.3.1x64 architecture only
Credential GuardRNYYYY
Device GuardNYYYYY
BitLockerRNNNNN
Configurable code integrityNNNNRR
Microsoft PassportRNNNNN
Windows HelloRNNNNN
VBSNYYYNY
UEFI Secure BootRNNNYN
Device health attestation through Measured BootYNNNYY

Study and implement the Lamport’s Bakery Algorithm for Interprocess synchronization using C/C++ programming language.


In Detail: 

One decentralized algorithm in common use, for example, in bakeries, is to issue numbers to each customer. When the customers want to access the scarce resource (the clerk behind the counter), they compare the numbers on their slips and the user with the lowest numbered slip wins.

The problem with this is that there must be some way to distribute numbers, but this has been solved. In bakeries, we use a very small server to distribute numbers, in the form of a roll of tickets where conflicts between two customers are solved by the fact that human hands naturally exclude each other from the critical volume of space that must be occupied to take a ticket. We cannot use this approach for solving the problem on a computer.

Before going on to more interesting implementations for distributing numbers, note that clients of such a protocol may make extensive use of their numbers! For example, if the bakery contains multiple clerks, the clients could use their number to select a clerk (number modulo number of clerks). Similarly, in a FIFO queue implemented with a bounded buffer, the number modulo the queue size could indicate the slot in the  buffer to be used, allowing multiple processes to simultaneously place values in the queue.

Lamport’s Bakery Algorithm provides a decentralized implementation of the “take a number” idea. As originally formulated, this requires that each competing process share access to an array, but later distributed algorithms have eliminated this shared data structure. Here is the original formulation:


For each process, i, there are two values, C[i] and N[i], giving the status of process I and the number it has picked. In more detail:

N[i] = 0 --> Process i is not in the bakery. 
N[i] > 0 --> Process i has picked a number and is in the bakery. 
C[i] = 0 --> Process i is not trying to pick a number. 
C[i] = 1 --> Process i is trying to pick a number. 
when 
N[i] = min( for all j, N[j] where N[j] > 0 ) 
Process i is allowed into the critical section. 
Here is the basic algorithm used to pick a number: 
C[i] := 1; 
N[i] := max( for all j, N[j] ) + 1; 
C[i] := 0; 

In effect, the customer walks into the bakery, checks the numbers of all the waiting
customers, and then picks a number one larger than the number of any waiting
customer.

If two customers each walk in at the same time, they are each likely to pick the same
number. Lamport’s solution allows this but then makes sure that customers notice that
this has happened and break the tie in a sensible way.

To help the customers detect ties, each customer who is currently in the process of
picking a number holds his hand up (by setting C[i] to 1. s/he pulls down his hand
when s/he is done selecting a number -- note that selecting a number may take time,
since it involves inspecting the numbers of everyone else in the waiting room.

 Solution

A process does the following to wait for the baker: 
Step 1: 
while (for some j, C(j) = 1) do nothing; 
First, wait until any process which might have tied with you has finished selecting 
their numbers. Since we require customers to raise their hands while they pick 
numbers, each customer waits until all handsare down after picking a number in order 
to guarantee that all ties will be cleanly recognised in the next step. 
Step 2: 
repeat 
W := (the set of j such that N[j] > 0) 
(where W is the set of indeces of waiting processes) 
M := (the set of j in W 
such that N[j] <= N[k] 
for all k in W) 
(where M is the set of process indices with minimum numbers) 
j := min(M) 
(where is in M and the tie is broken) 
until i = j;

C implementation 

#include "pthread.h"
#include "stdio.h"
#include "unistd.h"
#include "string.h"
#define MEMBAR __sync_synchronize()
#define THREAD_COUNT 8
volatile int tickets[THREAD_COUNT];
volatile int choosing[THREAD_COUNT];
volatile int resource;
void lock(int thread) {
choosing[thread] = 1;
MEMBAR;
int max_ticket = 0;
for (int i = 0; i < THREAD_COUNT; ++i) {
int ticket = tickets[i];
max_ticket = ticket > max_ticket ? ticket : max_ticket;
}
tickets[thread] = max_ticket + 1;
MEMBAR;
choosing[thread] = 0;
MEMBAR;
for (int other = 0; other < THREAD_COUNT; ++other) {
while (choosing[other]) { }
MEMBAR;
while (tickets[other] != 0 &&
(tickets[other] < tickets[thread] ||
(tickets[other] == tickets[thread] && other < thread))) { }
}
}
void unlock(int thread) {
MEMBAR;
tickets[thread] = 0;
}
void use_resource(int thread) {
if (resource != 0) {
printf("Resource was acquired by %d, but is still in-use by %d!\n",
thread, resource);
}
resource = thread;
printf("%d using resource...\n", thread);
MEMBAR;
sleep(2);
resource = 0;
}
void *thread_body(void *arg) {
long thread = (long)arg;
lock(thread);
use_resource(thread);
unlock(thread);
return NULL;
}
int main(int argc, char **argv) {
memset((void*)tickets, 0, sizeof(tickets));
memset((void*)choosing, 0, sizeof(choosing));
resource = 0;
pthread_t threads[THREAD_COUNT];
for (int i = 0; i < THREAD_COUNT; ++i) {
pthread_create(&threads[i], NULL, &thread_body, (void*)((long)i));
}
for (int i = 0; i < THREAD_COUNT; ++i) {
pthread_join(threads[i], NULL);
}
return 0;
}
Second, wait until your ticket number is the minimum of all tickets in the room. There
may be others with this minimum number, butin inspecting all the tickets in the room, you found them! If you find a tie, see if your customer ID number is less than the ID numbers of those with whom you’ve tied, and only then enter the critical section and meet with the baker.

Conclusion

The solution shown above is simple. Instead of computing the value of the smallest
number, compute the minimum process ID among the processes that hold the smallest
value. In fact, we need not seek the minimum process ID, all we need to do is use any
deterministic algorithm that all participants can agree on for breaking the tie. As long
as all participants apply the same deterministic algorithms to the same information,
they will arrive at the same conclusion.