Tuesday, December 06, 2016

Keys in DBMS

KEY: - A key is a single attribute or combination of two or more attributes of an entity set that is used to identify one or more instances of the set. Eg. The attribute employee soc_sec_no. uniquely identifies while the employee skill would be unique i.e. Identify more than one instance.

PRIMARY KEY: - If there is a case two instances of an entity set could have the same value for all its attributes. Hence to distinguish such instances, we introduce the unique attribute and will identify an instance of the entity set. Such unique entity identifier is referred to as a PRIMARY KEY.

SUPER KEY: - If we add additional attributes to a primary key, the resulting combination would still uniquely identify an instance of the entity set. Such augmented keys are called SUPER KEYS. So here we called Primary Key is minimum SUPER KEY.

CANDIDATE KEY: - Candidate keys are defined as the set of fields from which primary key can be selected. It is an attribute or set of attribute that can act as a primary key for a table to uniquely identify each  record in that table.

COMPOSITE KEY:- Key that consists of two or more attributes that uniquely identify an entity is called Composite key. But any attribute that makes up the Composite key is not a simple key in its own.

ALTERNATE KEY: - In the case of candidate key we must decide which of the candidate key e must decide which of the candidate key will used as the primary key. The remaining candidate keys would be considered as ALTERNATE KEY.

SECONDARY KEY: - It is an attribute or combinations of attributes that classifies the entity set on a particular characteristic. It may not be a candidate key. Eg. The entity set EMPLOYEE having the attribute department, which identifies by its value all instances of EMPLOYEE who belongs to a given department. More than one employee may belong to a department, so the department attribute is not a candidate key for the entity set EMPLOYEE.

FOREIGN KEY :- A FOREIGN KEY is a field (or collection of fields) in one table, that refers to the PRIMARY KEY in another table. The table with the foreign key is called the child table, and the table with the primary key is called the referenced or parent table. 
Foreign keys are the columns of a table that points to the primary key of another table. They act as a cross-reference between tables.

Database Terms



ENTITIES: - Entities are the basic units used in modelling stones of concrete or abstract objects. All such items about which relevant information is stored in the database are called ENTITIES. ENTITY is the identical objects which are transformed from manual to computer system. E.g.  Building, room, chair, transaction, course, machine, employee.

ATTRIBUTES: - The qualities of the entity which we store as information are called the attributes. OR The properties that characterize an entity set are called as attributes. It is also referred as data item, data element, data field, items, elementary item or object property.


DOMAIN: - Each attribute of an entity set has a particular value. The set of possible values that a given attribute can have is called its DOMAIN. Eg. The set of value that the attribute EMPLOYEE. Salary may have take is a positive number ranging between 0.00 and 9,999,999.00.

ENTITY SET               ATTRIBUTES                                 VALUE
EMPLOYEE                          EMPLOYEE.soc_sec_no                               1254
EMPOYEE.Name                                          Amitesh
                                                EMPLOYEE. Address                                   Patna
                                                EMPLOYEE.Desgnation                               System admin
                                                EMPLOYEE. Skill                                         DBA
                                                EMPLOYEE. Salary                                      45056.00

Process Scheduling

Process Scheduling

The act of determining which process in the ready state should be moved to the running state is known as Process Scheduling.
The prime aim of the process scheduling system is to keep the CPU busy all the time and to deliver minimum response time for all programs. For achieving this, the scheduler must apply appropriate rules for swapping processes IN and OUT of CPU.

Process Scheduler

The process scheduler is the component of the operating system that is responsible for deciding whether the currently running process should continue running and, if not, which process should run next. There are four events that may occur where the scheduler needs to step in and make this decision:
  1. The current process goes from the running to the waiting state because it issues an I/O request or some operating system request that cannot be satisfied immediately.
  2. The current process terminates.
  3. A timer interrupt causes the scheduler to run and decide that a process has run for its allotted interval of time and it is time to move it from the running to the ready state.
  4. An I/O operation is complete for a process that requested it and the process now moves from the waiting to the ready state. The scheduler may then decide to preempt the currently-running process and move this newly-ready process into the running state.

Schedulers fell into one of the two general categories :
  • Non pre-emptive scheduling. A scheduler is a preemptive scheduler if it has the ability to get invoked by an interrupt and move a process out of a running state to let another process run.When the currently executing process gives up the CPU voluntarily.
  • Pre-emptive scheduling. If a scheduler cannot take the CPU away from a process then it is a cooperative, or non-preemptive scheduler. When the operating system decides to favour another process, pre-empting the currently executing process.

 

PROCESS CONTROL BLOCK

PROCESS CONTROL BLOCK

 Process Control Block (PCB, also called Task Controlling Block, process table, Task Struct, or Switchframe) is a data structure in the operating system kernel containing the information needed to manage a particular process. There is a Process Control Block for each process, enclosing all the information about the process. It is a data structure, which contains the following :

 

  • Process State - It can be running, waiting etc.
  • Process ID and parent process ID.
  • CPU registers and Program Counter. Program Counter holds the address of the next instruction to be executed for that process.
  • CPU Scheduling information - Such as priority information and pointers to scheduling queues.
  • Memory Management information - Eg. page tables or segment tables.
  • Accounting information - user and kernel CPU time consumed, account numbers, limits, etc.
  • I/O Status information - Devices allocated, open file tables, etc.

Process and Process State

What is a Process?

A program in the execution is called a Process. Process is not the same as program. A process is more than a program code. A process is an 'active' entity as opposed to program which is considered to be a 'passive' entity. Attributes held by process include hardware state, memory, CPU etc.

PROCESS STATE

Processes can be any of the following states :

  • New - The process is in the stage of being created.
  • Ready - The process has all the resources available that it needs to run, but the CPU is not currently working on this process's instructions.
  • Running - The CPU is working on this process's instructions.
  • Waiting - The process cannot run at the moment, because it is waiting for some resource to become available or for some event to occur.
  • Terminated - The process has completed.

Monday, December 05, 2016

Difference Between Primary and Secondary Memory

         Difference between Primary and Secondary Memory


Primary Memory
Secondary Memory
These are semiconductor memories. These are magnetic and optical memories.
They are characterized as volatile random access memories (RAM) or on-volatile memories (ROM). They are non-volatile.
They contain program and data that is currently being used by micro processor. These are used to for bulk storage.
These memories are fast enough to interact with the microprocessor. Slower than primary memories.
Also known as Main Memory Also known as Backup Memory or Auxiliary Memory. E.g. Tapes, Floppies, Hard Discs, CD ROMs, DVDs

Secondary Memory

Secondary Memory/Non Volatile Menory

Secondary memory (or secondary storage) is the slowest and cheapest form of memory. It cannot be processed directly by the CPU. It must first be copied into primary storage (also known as RAM).
Secondary memory is computer memory that is non-volatile and persistent in nature and is not directly accessed by a computer/processor. It allows a user to store data that may be instantly and easily retrieved, transported and used by applications and services.
Secondary memory is also known as secondary storage.
Secondary memory devices include magnetic disks like hard drives and floppy disks ; optical disks such as CDs and CDROMs ; and magnetic tapes, which were the first forms of secondary memory.
Secondary memory is slower than primary memory but can store and retain data, even if the computer is not connected to electrical power. It also has substantial storage capacities, ranging from some MBs to several TBs of storage space within single memory.

Primary Memory


Primary Memory / Volatile Memory:

Primary Memory also called as volatile memory because the memory can’t store the data permanently. Primary memory select any part of memory when user want to save the data in memory but that may not be store permanently on that location. It also has another name i.e. RAM.

Random Access Memory (RAM):

The primary storage is referred to as random access memory (RAM) due to the random selection of memory locations. It performs both read and write operations on memory. If power failures happened in systems during memory access then you will lose your data permanently. So, RAM is volatile memory. RAM categorized into following types.
  • DRAM
  • SRAM
  • DDRRAM (Dual Data Rate RAM)

Read Only Memory (ROM) :

ROM is permanent memory location that offer huge types of standards to save data. But it work with read only operation. No data lose happen whenever power failure occur during the ROM memory work in computers.
ROM memory has several models such names are following.
1. PROM: Programmable Read Only Memory (PROM) maintains large storage media but can’t offer the erase features in ROM. This type of RO maintains PROM chips to write data once and read many. The programs or instructions designed in PROM can’t be erased by other programs.
2. EPROM : Erasable Programmable Read Only Memory designed for recover the problems of PROM and ROM. Users can delete the data of EPROM thorough pass on ultraviolet light and it erases chip is reprogrammed.
3. EEPROM: Electrically Erasable Programmable Read Only Memory similar to the EPROM but it uses electrical beam for erase the data of ROM.

Memory (Computer)

Memory (Computer)

Computer memory is any physical device capable of storing information temporarily or permanently. For example, Random Access Memory (RAM), a memory that stores information on an integrated circuit. Moreover, the term memory is usually used as a shorthand for physical memory, which refers to the actual chips capable of holding data. Some computers also use virtual memory, which expands physical memory onto a hard disk. Every computer comes with a certain amount of physical memory, usually referred to as main memory or RAM. You can think of main memory as an array of boxes, each of which can hold a single byte of information. 

Types of Computer Memory:

Memory is the best essential element of a computer because computer can’t perform simple tasks. The performance of computer mainly based on memory and CPU. Memory is internal storage media of computer that has several names such as majorly categorized into two types, Main memory and Secondary memory.
1. Primary Memory / Volatile Memory.
2. Secondary Memory / Non Volatile Memory.