<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Pranavi nerella</title>
    <description>The latest articles on DEV Community by Pranavi nerella (@pranavi333).</description>
    <link>https://dev.to/pranavi333</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F626644%2F824d9612-33bc-474a-ba80-2530bfce3f72.png</url>
      <title>DEV Community: Pranavi nerella</title>
      <link>https://dev.to/pranavi333</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pranavi333"/>
    <language>en</language>
    <item>
      <title>multithreading and multiprocessing</title>
      <dc:creator>Pranavi nerella</dc:creator>
      <pubDate>Sun, 24 Oct 2021 09:36:13 +0000</pubDate>
      <link>https://dev.to/pranavi333/multithreading-and-multiprocessing-490j</link>
      <guid>https://dev.to/pranavi333/multithreading-and-multiprocessing-490j</guid>
      <description>&lt;p&gt;Python Multithreading:-&lt;/p&gt;

&lt;p&gt;Multithreading is a threading technique in Python programming to run multiple threads concurrently by rapidly switching between threads with a CPU help (called context switching). Besides, it allows sharing of its data space with the main threads inside a process that share information and communication with other threads easier than individual processes. Multithreading aims to perform multiple tasks simultaneously, which increases performance, speed and improves the rendering of the application&lt;/p&gt;

&lt;p&gt;When to use Multithreading in Python?&lt;/p&gt;

&lt;p&gt;It is a very useful technique for time-saving and improving the performance of an application. Multithreading allows the programmer to divide application tasks into sub-tasks and simultaneously run them in a program. It allows threads to communicate and share resources such as files, data, and memory to the same processor. Furthermore, it increases the user's responsiveness to continue running a program even if a part of the application is the length or blocked.&lt;/p&gt;

&lt;p&gt;python multiprocessing:-&lt;/p&gt;

&lt;p&gt;Multiprocessing refers to the ability of a system to support more than one processor at the same time. Applications in a multiprocessing system are broken to smaller routines that run independently. The operating system allocates these threads to the processors improving performance of the system.&lt;/p&gt;

&lt;p&gt;When to use Multiprocessing in Python?&lt;/p&gt;

&lt;p&gt;Multiprocessing is essential to perform the multiple tasks within the Computer system. Suppose a computer without multiprocessing or single processor. We assign various processes to that system at the same time.&lt;br&gt;
It will then have to interrupt the previous task and move to another to keep all processes going. It is as simple as a chef is working alone in the kitchen. He has to do several tasks to cook food such as cutting, cleaning, cooking, kneading dough, baking, etc.&lt;br&gt;
Therefore, multiprocessing is essential to perform several task at the same time without interruption. It also makes easy to track all the tasks. That is why the concept of multiprocessing is to arise.&lt;br&gt;
Multiprocessing can be represented as a computer with more than one central processor.&lt;br&gt;
A Multi-core processor refers to single computing component with two or more independent units.&lt;/p&gt;

</description>
      <category>python</category>
    </item>
    <item>
      <title>FILE HANDALING</title>
      <dc:creator>Pranavi nerella</dc:creator>
      <pubDate>Thu, 06 May 2021 14:26:55 +0000</pubDate>
      <link>https://dev.to/pranavi333/file-handaling-119j</link>
      <guid>https://dev.to/pranavi333/file-handaling-119j</guid>
      <description>&lt;p&gt;A file is the name of memory location where we can store data permanently under computer’s hard disk. Java language supports a set of classes in java.io package to create and maintain files. The following are some of the classes we can use to create and maintain files :&lt;/p&gt;

&lt;p&gt;FileInputStream&lt;br&gt;
FileOutputStream&lt;br&gt;
FileWriter etc.,&lt;/p&gt;

&lt;p&gt;FileOutputStream class :&lt;/p&gt;

&lt;p&gt;This class represent data as a stream of bytes. The objects of this class can be used to open and access a file in write mode. The object for this class can be created as below :&lt;/p&gt;

&lt;p&gt;FileOutputStream fis = new FileOutputStream(“file-name”,boolean-value); Here, if the boolean value is true, the file can be opened in append mode. If it is false,the data is overwritten from the beginning of the file every time when we execute the program.The following program demonstrates the use of this class.&lt;/p&gt;

&lt;p&gt;/* Program to store data into a file using FileOutputStream class */&lt;/p&gt;

&lt;p&gt;import java.io.*;&lt;/p&gt;

&lt;p&gt;class FileWrite{&lt;/p&gt;

&lt;p&gt;public static void main(String args[]) throws Exception {&lt;/p&gt;

&lt;p&gt;InputStreamReader isr = new InputStreamReader(System.in);&lt;/p&gt;

&lt;p&gt;BufferedReader br = new BufferedReader(isr);&lt;/p&gt;

&lt;p&gt;System.out.println(“Enter some text “);&lt;/p&gt;

&lt;p&gt;String data = br.readLine();&lt;/p&gt;

&lt;p&gt;FileOutputStream fos = new FileOutputStream(“file1.txt”,true);&lt;/p&gt;

&lt;p&gt;/* Because data is in the form of String object, convert it into byte array */&lt;/p&gt;

&lt;p&gt;byte b[] = data.getBytes();&lt;/p&gt;

&lt;p&gt;fos.write(b); /* writes byte array into file.txt */&lt;/p&gt;

&lt;p&gt;fos.close();&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;FileInputStream class :&lt;/p&gt;

&lt;p&gt;This clas represents data as a stream of bytes. The objects of this class can be used to open and access a file in read mode. The object for this class can be created as below :&lt;/p&gt;

&lt;p&gt;FileInputStream fis = new FileInputStream(“file-name”);&lt;/p&gt;

&lt;p&gt;The following program demonstrates the use of this class.&lt;/p&gt;

&lt;p&gt;/* Program to read data from a file using FileInputStream class */&lt;/p&gt;

&lt;p&gt;import java.io.*;&lt;/p&gt;

&lt;p&gt;class FileRead {&lt;/p&gt;

&lt;p&gt;public static void main(String args[]) throws Exception {&lt;/p&gt;

&lt;p&gt;FileInputStream fis = new FileInputStream(“file1.txt”);&lt;/p&gt;

&lt;p&gt;int size = fis.available(); /* available() returns no. of bytes in file1.txt */&lt;/p&gt;

&lt;p&gt;byte b [] = new byte[size];&lt;/p&gt;

&lt;p&gt;/* create a byte array of file size */&lt;/p&gt;

&lt;p&gt;fis.read(b);&lt;/p&gt;

&lt;p&gt;String data = new String(b);&lt;/p&gt;

&lt;p&gt;/* convert the byte array to string */&lt;/p&gt;

&lt;p&gt;System.out.println(“The contents of file1.txt are : “ + data);&lt;/p&gt;

&lt;p&gt;}// end of main&lt;/p&gt;

&lt;p&gt;}// end of class&lt;/p&gt;

&lt;p&gt;FileWriter class :&lt;/p&gt;

&lt;p&gt;This class represent data as a stream of characters. The objects of this class can be used to open and access a file in write mode. The object for this class can be created as below :&lt;/p&gt;

&lt;p&gt;FileWriter fw = new FileWriter(filename,boolean-value);&lt;/p&gt;

&lt;p&gt;The following program demonstrates the use of FileWriter class.&lt;/p&gt;

&lt;p&gt;import java.io.*;&lt;/p&gt;

&lt;p&gt;class FileWrite {&lt;/p&gt;

&lt;p&gt;public static void main(String args[]) throws Exception {&lt;/p&gt;

&lt;p&gt;FileWriter fw = new FileWriter(“file2.txt”,true);&lt;/p&gt;

&lt;p&gt;BufferedReader br = new BufferedReader(new InputStreamReader(System.in));&lt;/p&gt;

&lt;p&gt;System.out.println(“Enter some text “);&lt;/p&gt;

&lt;p&gt;String data = br.readLine();&lt;/p&gt;

&lt;p&gt;// convert data into equalent character array&lt;/p&gt;

&lt;p&gt;char ch[] = data.toCharArray();&lt;/p&gt;

&lt;p&gt;fw.write(ch);&lt;/p&gt;

&lt;p&gt;fw.close();&lt;/p&gt;

&lt;p&gt;} // end main&lt;/p&gt;

&lt;p&gt;} // end class&lt;/p&gt;

</description>
      <category>java</category>
    </item>
  </channel>
</rss>
