Skip to main content

Posts

Operating System-SEM 3

Give Java solution to Bounded buffer problem. import java.io.*; class Buffer { private final int MaxBuffSize; private char[] store; private int BufferStart, BufferEnd, BufferSize; public Buffer(int size) { MaxBuffSize = size; BufferEnd = -1; BufferStart = 0; BufferSize = 0; store = new char[MaxBuffSize]; } public synchronized void insert(char ch) { try { while (BufferSize == MaxBuffSize) { wait(); } BufferEnd = (BufferEnd + 1) % MaxBuffSize; store[BufferEnd] = ch; BufferSize++; notifyAll(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } public synchronized char delete() { try { while (BufferSize == 0) { wait(); } char ch = store[BufferStart]; BufferStart = (BufferStart + 1) % MaxBuffSize; BufferSize--; notifyAll(); return ch; } catch (InterruptedException e) { Thread.currentThread().interrupt(); return 'i'; } } } class Consumer extends Thread { private final Buffer buffer; public Consumer(Buff...
Recent posts

JAVA Programs SEM-3

                                                                                         //Constructor class TestConstructor { int a,b; TestConstructor() { System.out.println("Default Constructor!!"); a=10; b=20; System.out.println("value of a="+a); System.out.println("value of b="+b); } } class MainConstructor  { public static void main(String args[]) { TestConstructor obj=new TestConstructor(); } }                                                                                     ...

Database Management-SEM 3

Creating and working with Insert/Update/Delete Trigger using Before/After clause. * Before Delete create table employee (employee_id Number, employee_name varchar2(1000), creation_date Date, created_by varchar2(1000) ); select * from employee; create or replace trigger employee_trigger before update on employee for each row declare v_creator_name varchar2(1000); begin select user into v_creator_name from dual; :new.creation_date:=sysdate; :new.created_by:=v_creator_name; end; / insert into employee values(1,'Shubham',null,null); insert into employee values(2,'Surve',null,null); update employee set employee_name='Jay' where employee_id=1; select * from new_employee; create table newemployee (employee_id number, employee_name varchar2(1000), creation_date Date, created_by varchar2(1000)); select * from newemployee; create table newemployee_duplicate as (select * from newemployee); select * from newemployee_duplicate; ...

Programming in C

 Programs to understand the basic data types and I/O // Program to show the use of basic datatypes #include<stdio.h> void main() {             int a;             float b;             double c;             long double sum;             char d;             clrscr();             printf("Enter the values of a,b and c: \n");             scanf("%d%f%lf",&a,&b,&c);             sum = a + b + c;           ...