World's most popular travel blog for travel bloggers.
Showing posts with label MCs-041 Solved Assignment. Show all posts
Showing posts with label MCs-041 Solved Assignment. Show all posts
With the aid of a diagram, describe what happens during the “fetch-execute” cycle. Include a description of how interrupts are  detected. List various types of interrupts. Also explain in detail what  happens when an interrupt occurs

Fetch/Execute Cycle

The fetch-execute cycle of the processor refers to the sequence that is completed for each instruction in a program.
  • Fetch Sequence
  1. Move the value in the program counter to the memory address register
  2. Send the value in the memory address register to memory via the address bus
  3. Return the value stored in memory via the data bus
  4. Store the value in the memory data register
  5. Copy the instruction from the memory address register to the instruction register
  6. Increment the program counter. The instruction in the instruction register is then Decoded
  • Execute Sequence

  1. The instruction is Executed

Types of Interrupts

Generally there are three types o Interrupts those are Occurred For Example

1)   Internal Interrupt
2)   Software Interrupt.
3)   External Interrupt.
The External Interrupt occurs when any Input and Output Device request for any Operation and the CPU will Execute that instructions first For Example When a Program is executed and when we move the Mouse on the Screen then the CPU will handle this External interrupt first and after that he will resume with his Operation. 
The Internal Interrupts are those which are occurred due to Some Problem in the Execution For Example When a user performing any Operation which contains any Error and which contains any type of Error. So that Internal Interrupts are those which are occurred by the Some Operations or by Some Instructions and the Operations those are not Possible but a user is trying for that Operation. And The Software Interrupts are those which are made some call to the System for Example while we are Processing Some Instructions and when we wants to Execute one more Application Programs.


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.